Concepts13

βš™οΈAlgorithmAdvanced

Parallel Binary Search

Parallel Binary Search (PBS) lets you binary-search the answers of many queries at once by batching them by their current mid value.

#parallel binary search#offline queries#monotone predicate+10
βš™οΈAlgorithmAdvanced

CDQ Divide and Conquer

CDQ divide and conquer is an offline technique that splits the timeline (or one coordinate) and lets updates from the left half contribute to queries in the right half.

#cdq divide and conquer#offline algorithm#fenwick tree+11
βš™οΈAlgorithmAdvanced

Mo's Algorithm - With Updates

Mo's algorithm with updates treats array modifications as a third dimension called time and answers range queries on the correct version of the array.

#mo's algorithm with updates#time dimension#offline range queries+11
βš™οΈAlgorithmIntermediate

Mo's Algorithm

Mo's algorithm answers many range queries offline by reordering them to minimize pointer movement along the array.

#mo's algorithm#offline queries#range queries+12
βš™οΈAlgorithmAdvanced

Rectangle Union Area

The union area of many axis-aligned rectangles can be computed efficiently using a sweep line over x and a segment tree tracking covered y-length.

#rectangle union area#line sweep#segment tree+12
βš™οΈAlgorithmIntermediate

Line Sweep

Line sweep (plane sweep) is a technique that processes geometric objects by moving an imaginary line and handling events in sorted order.

#line sweep#plane sweep#event queue+12
βš™οΈAlgorithmIntermediate

LIS Variants

LIS variants extend the classic longest increasing subsequence to handle non-decreasing sequences, counting how many LIS exist, and maximizing the sum of a subsequence.

#lis#lnds#patience sorting+12
βš™οΈAlgorithmIntermediate

Coordinate Compression

Coordinate compression replaces large, sparse, or arbitrary values with small consecutive integers while preserving relative order.

#coordinate compression#discretization#lower_bound+12
πŸ—‚οΈData StructureAdvanced

Wavelet Tree

A wavelet tree is a recursive data structure built over a sequence’s alphabet that answers rank, select, and quantile (k-th smallest) queries in O(log Οƒ) time, where Οƒ is the number of distinct values.

#wavelet tree#wavelet matrix#rank select+11
πŸ—‚οΈData StructureAdvanced

Persistent Segment Tree

A persistent segment tree stores every historical version of an array-like data while supporting queries and updates in O(log n) time.

#persistent segment tree#path copying#kth smallest+12
πŸ—‚οΈData StructureIntermediate

Merge Sort Tree

A Merge Sort Tree is a segment tree where every node stores the sorted list of values in its segment.

#merge sort tree#segment tree#range query+12
πŸ—‚οΈData StructureIntermediate

2D Fenwick Tree

A 2D Fenwick Tree (Binary Indexed Tree) supports point updates and rectangle sum queries in O(log n Γ— log m) time.

#2d fenwick tree#binary indexed tree 2d#bit 2d+12