Level 3 · Advanced Data StructuresBUILD YOUR INTUITION
Trees
A node owns smaller subtrees. Many global answers can be assembled from child answers.
THE MENTAL MODELWhen should this come to mind?
A node owns smaller subtrees. Many global answers can be assembled from child answers.
Root-to-leaf pathsSubtree summariesHierarchical relationships What makes it work
A binary node has at most two children; skewed trees can have height n.
When to choose something else
Cycles and multiple parent paths require graph reasoning.
See the pattern in action
Change the input. Follow the state. Make it yours.