Concepts3
🗂️Data StructureAdvanced
HLD - Path Queries and Updates
Heavy-Light Decomposition (HLD) breaks a tree into a small number of vertical chains so any path (u,v) becomes O(log n) contiguous segments in an array.
#heavy light decomposition#hld#path query+12
🗂️Data StructureIntermediate
Sparse Table
A Sparse Table is a static range-query data structure that preprocesses an array in O(n \log n) time and answers many queries in O(1) time.
#sparse table#range minimum query#rmq+12
🗂️Data StructureIntermediate
Monotonic Deque
A monotonic deque is a double-ended queue that keeps elements in increasing or decreasing order so that the front always holds the current optimum (min or max).
#monotonic deque#sliding window maximum#sliding window minimum+12