Implementing Bloom Filters and Hash Function Applications
Bloom Filter Implementation
Fundamentals of Bloom Filters
Scenario: An unsafe webpage blacklist contains 100 billion URLs, each occupying up to 64 bytes. Design a filtering system to check if a URL exists in the blacklist.
Requirements:
1) Allow false positive rate below 0.01%
2) Additional space must not exceed 30GB (≈30×10^9 bytes)
Analysis ...
Posted on Wed, 24 Jun 2026 17:07:19 +0000 by BrandonK
Binary Search Patterns: Solving Common LeetCode Array Problems
Binary search is a fundamental algorithm that efficiently locates target values in sorted arrays. This article explores several classic LeetCode problems that leverage binary search, along with related array manipulation techniques.
Problem 704: Binary Search
When performing binary search on a sorted array, the choice of boundary conditions sig ...
Posted on Wed, 24 Jun 2026 16:35:07 +0000 by Lefu
Implementing a Contact Directory Using Sequential Lists
Building upon an existing sequential list implementation, we can create a comprehensive contact directory system. This system typically requires operations such as adding contacts, removing entries, searching for specific inidviduals, updating information, viewing all records, and exiting the application.
Header File Definition
First, create a ...
Posted on Sun, 21 Jun 2026 17:55:23 +0000 by MaxBodine
Linked List Operations: Swapping Nodes, Removing Nth Node, Finding Intersections, and Detecting Cycles
Pairwise Node Swapping
To swap adjacent nodes in pairs, we utilize a dummy node to simplify edge cases. The core idea involves manipulating pointers to reverse each pair while maintaining proper linkage with the rest of the list. A cursor pointer tracks the predecessor of each pair being processed.
The termination condition varies based on whet ...
Posted on Sat, 20 Jun 2026 16:35:52 +0000 by matt6805
Programming Competition Problem Solutions and Analysis
Mathematical Caclulation Problem
Given the formula for distance between a point and a line, we can simpliyf the calculation to |x-y| * 50:
#include <iostream>
#include <cmath>
int main() {
int x, y;
std::cin >> x >> y;
std::cout << abs(y - x) * 50 << '\n';
return 0;
}
String Output Problem
S ...
Posted on Fri, 19 Jun 2026 18:14:18 +0000 by jantheman
Merge Sort Implementation for Singly Linked Lists
Algorithm Overview
Split: Use slow-fast pointer technique to locate the midpoint and partition the list into two halves.
Recurse: Apply the same sorting procedure recursively on both halves.
Merge: Combine the two sorted sublists into a single sorted list using a linear-time merge step.
Implementation
class ListNode {
int value;
ListN ...
Posted on Fri, 19 Jun 2026 17:24:15 +0000 by brainstem
Palindrome Linked List Detection
Problem Description
Given the head of a singly linked list, determine if the list is a palindrome. Return true if it is, otherwise return false.
An optimal solution achieves O(n) time complexity and O(1) space complexity by combining a fast-slow pointer approach to find the middle node with a reversal of the latter half of the list.
Algorithm O ...
Posted on Thu, 18 Jun 2026 17:48:25 +0000 by jamesnkk
Segment Tree Implementation for Range Queries and Updates
The segment tree is constructed recursively. Each node tracks its segment boundaries [left, right]. Leaf nodes correspond to individual array elements, while enternal nodes store the sum of their children.
struct SegmentTree {
int left[MAX_N * 4], right[MAX_N * 4];
long long value[MAX_N * 4], lazy[MAX_N * 4];
void build(int l, int ...
Posted on Thu, 18 Jun 2026 17:26:51 +0000 by hkothari
Sorting and Searching Algorithms
Sorting algorithms arrange elements in a specific order. Understanding these fundamental algorithms is essential for any programmer.
Stability in Sorting Algorithms
A sorting algorithm is stable if it maintains the relative order of equal elements. When a stable sort is applied to elements with equal keys, their original sequence is preserved.
...
Posted on Thu, 18 Jun 2026 17:11:24 +0000 by Bullet
Efficient Sorting and Merging with Heap Data Structures
Heap Data Structure Implementation
Heaps are specialized tree-based data structures that satisfy the heap property. They are commonly used to implement priority queues and for efficient sorting algorithms. This article explores two practical applications of heaps: heap sort and sequence merging.
Heap Sort Implemantation
Heap sort is an efficien ...
Posted on Thu, 18 Jun 2026 16:37:37 +0000 by Eddie Fisher