Recent
Array Scanning
·7 mins
Algorithm
Array
Simulation
Enumeration
Adjacent comparisons and walking monotonic runs (uphill, downhill, hills and valleys), keeping prefix / suffix maximums and sums in one pass, enumerating pairs in small ranges, and breaking ties with tuple keys
Bit Manipulation
·5 mins
Algorithm
Bit-Manipulation
Common bit operations, AND only removes bits while OR only adds them, finding adjacent ones with n & (n » 1), and all-ones numbers 2^k - 1
Bucket Sort and the Pigeonhole Principle
·2 mins
Algorithm
Bucket-Sort
Pigeonhole-Principle
Sorting
Split the value range into n - 1 buckets; the largest gap can never fall inside one bucket, so keeping each bucket’s minimum and maximum finds the maximum adjacent difference in linear time
Hash Table
·8 mins
Algorithm
Hash-Table
Counting
Array
Counting and frequency of frequencies, using the array itself as a hash table (sign marking), counting several keys at once (rows, columns, diagonals), incremental counts from a fixed left end, and grouping by a normalized key
Linked List
·6 mins
Algorithm
Linked-List
Two-Pointers
Dummy heads, reversal (whole list, a range, half), fast and slow pointers for middles and cycles, two pointers n apart, pairwise swaps, two lists meeting, and copying a list with random pointers via a hash map
Matrix
·5 mins
Algorithm
Matrix
Simulation
Array
Transposing and rotating, converting between 2D indices and a 1D sequence, neighbors and diagonals, and spiral traversal with four boundaries
Segment Tree and Fenwick Tree
·3 mins
Algorithm
Segment-Tree
Binary-Indexed-Tree
Design
Point updates with range queries: a Fenwick tree (binary indexed tree) jumps by i & -i, and a segment tree recursively halves the range; both take O(log n) per operation
SQL Basics
·3 mins
Algorithm
Database
Sql
Combining conditions in SELECT … WHERE, and NULL’s three-valued logic: any comparison with NULL is not true, so use IS NULL
String
·7 mins
Algorithm
String
Simulation
Hash-Table
Simulation by building a list, parsing by trying every pattern at each position, all substrings of length k, counting by character class, checking balanced substrings from a fixed start, and splitting into words
Backtracking
·6 mins
Algorithm
Backtracking
Recursion
Dfs
Pruning
The choose, recurse, undo template for subsets, permutations, constrained placement, grid search, and pruning
BFS and Graph Traversal
·6 mins
Algorithm
Bfs
Dfs
Graph
Matrix
Union-Find
Connected components, grid flood fill, multi-source BFS, state-space BFS, shortest cycles, and recursion depth in DFS
Binary Search
·7 mins
Algorithm
Binary-Search
Prefix-Sum
Two-Pointers
Lower / upper bound, binary search on the answer, k-th smallest, integer roots, and why the two interval styles must not be mixed
