Concepts10

βš™οΈAlgorithmIntermediate

Complexity Analysis Quick Reference

Use an operation budget of about 10^8 simple operations per second on typical online judges; always multiply by the time limit and number of test files if known.

#time complexity#competitive programming#big-o+12
βš™οΈAlgorithmIntermediate

Small-to-Large Principle

Small-to-large means always merge the smaller container into the larger one to keep total work low.

#small-to-large#sack technique#dsu on tree+11
βš™οΈAlgorithmIntermediate

Double Counting

Double counting is the strategy of counting the same quantity in two different ways to derive an equality or an efficient algorithm.

#double counting#contribution technique#handshake lemma+12
βš™οΈAlgorithmIntermediate

Think Backwards (Reverse Thinking)

Think Backwards is a problem‑solving pattern where you reverse time or direction so hard deletions become easy insertions and the final state becomes the starting point.

#think backwards#reverse thinking#offline queries+12
βš™οΈAlgorithmIntermediate

Invariant Maintenance

An invariant is a property you promise to keep true throughout an algorithm, and it is the anchor of both design and correctness proofs.

#invariant#loop invariant#search invariant+12
βš™οΈAlgorithmAdvanced

Sqrt Decomposition on Queries

Sqrt decomposition on queries (time blocking) processes Q operations in blocks of size about \(\sqrt{Q}\) to balance per-query overhead and rebuild cost.

#sqrt decomposition#time blocking#query blocking+12
βš™οΈAlgorithmIntermediate

Small-to-Large Merging

Small-to-large merging is a technique where you always merge the smaller container into the larger one to guarantee low total work.

#small-to-large merging#dsu on tree#sack technique+11
βš™οΈAlgorithmIntermediate

Minimum Rotation

The minimum rotation of a string is the lexicographically smallest string you can get by cutting it at some position and swapping the two parts.

#minimum rotation#booth algorithm#duval algorithm+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

Sliding Window

Sliding window is a technique that moves a contiguous segment (window) across an array or string while maintaining some running information like sum, count, or max.

#sliding window#two pointers#variable window+11