Concepts10

⚙️AlgorithmIntermediate

Meet in the Middle

Meet-in-the-middle splits a hard exponential search into two halves, enumerates each half, and then combines results efficiently.

#meet in the middle#subset sum#pair sums+12
⚙️AlgorithmIntermediate

Point in Polygon

Point-in-polygon decides whether a point lies outside, inside, or on the boundary of a polygon.

#point in polygon#ray casting#winding number+11
⚙️AlgorithmIntermediate

String Hashing (Polynomial Hash)

Polynomial string hashing encodes a string as a base-p number modulo a large prime, letting us compare substrings in O(1) after O(n) preprocessing.

#string hashing#polynomial hash#rolling hash+12
⚙️AlgorithmIntermediate

Exchange Arguments in DP

An exchange argument proves that any optimal solution can be reordered to satisfy a simple sorting rule by showing that swapping adjacent out-of-order elements never helps.

#exchange argument#adjacent swap#smith rule+12
⚙️AlgorithmAdvanced

Convex Hull Trick (CHT)

The Convex Hull Trick (CHT) speeds up dynamic programs where each state is a minimum over linear functions, such as dp[i] = min_j (dp[j] + b[j] × a[i]).

#convex hull trick#cht#dynamic programming optimization+12
⚙️AlgorithmIntermediate

Longest Increasing Subsequence

The Longest Increasing Subsequence (LIS) is the longest sequence you can extract from an array while keeping the original order and making each next element strictly larger.

#longest increasing subsequence#lis#dynamic programming+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
⚙️AlgorithmIntermediate

Binary Search

Binary search quickly finds targets or boundaries in sorted or monotonic data by halving the search interval each step.

#binary search#lower_bound#upper_bound+11
🗂️Data StructureAdvanced

Suffix Array

A suffix array stores the starting indices of all suffixes of a string in lexicographic order.

#suffix array#lcp array#kasai algorithm+11
🗂️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