Essential data structures for CP
Prefix tree for string storage with insert, search, prefix check, and erase in O(|s|).
Self-adjusting BST with O(log n) amortized operations via splay rotations.
Policy-based order-statistics tree — find k-th element and count elements less than x in O(log n).
Next/previous greater/smaller element queries in O(n) using a monotonic stack.
Sliding window min/max in O(1) amortized using the two-stack queue pattern.
Dynamic forest structure supporting link, cut, and path queries in O(log n) amortized.
Index-keyed splay tree for sequence operations — insert, erase, range query with lazy propagation.
Decomposes a tree into chains for O(log^2 n) path queries using a segment tree.
Min/max binary heap with push, pop, and top in O(log n).
Disjoint Set Union with path compression and union by size in near-constant amortized time.
Trie on bit representation of integers — supports insert, erase, and XOR maximum query.
Basic BST with insert, delete, search, min/max, and all four traversal orders.