Concepts2
🗂️Data StructureAdvanced
Centroid Decomposition - Distance Queries
Centroid decomposition splits a tree into levels by repeatedly removing a centroid so that each remaining component is at most half the size.
#centroid decomposition#tree distance queries#nearest red node+12
🗂️Data StructureIntermediate
Queue and Deque
A queue is a First-In-First-Out (FIFO) line where you add at the back and remove from the front in O(1) time.
#queue#deque#fifo+12