Advanced·Concept·2 min read

Advanced patterns

Practice this question

Monotonic stack

Used for nearest greater/smaller and histogram problems.

Trie

Used for dictionary and prefix matching.

Union-Find

Used for connectivity and grouping.

Segment tree

Used for range queries and updates.

Fenwick tree

Used for prefix sums and updates in O(log n).


Adapted from 14_DSA_MASTER.md · “16. Advanced patterns”. Code examples are study fragments. Difficulty and core labels are editorial estimates; version-specific behavior should be checked against your project.