Part V · Trees, Priority Structures and Range Queries
24. Tree Fundamentals and Traversal
8 lessons•50 topics•Intermediate / Advanced
8 of 8 lessons published
24.019 animated
Tree anatomy
- Root
- Parent
- Child
- Leaf
- Edge
- Height
- Depth
- Level
- Degree
- Subtree
- Forest
- Binary vs general trees
24.021 animated
Binary tree representation
- TreeNode class
- Left/right child
- Recursive construction
- Array representation
- Null children
24.036 animated
Traversal methods
- Preorder
- Inorder
- Postorder
- Recursive DFS
- Iterative stack traversals
- Level-order BFS
24.046 animated
Level and view problems
- Level order
- Zigzag traversal
- Left view
- Right view
- Top/bottom views
- Vertical traversal
24.056 animated
Structural computations
- Count nodes
- Height
- Diameter
- Balanced tree check
- Leaf count
- Sum and max path sum
24.065 animated
Path problems
- Root-to-leaf paths
- Path sum
- Lowest common ancestor basics
- Distance between nodes
- Boundary traversal
24.075 animated
Tree transformation
- Invert tree
- Flatten tree
- Build from preorder+inorder
- Build from postorder+inorder
- Serialize/deserialize
24.085 animated
General trees
- N-ary tree traversal
- Parent array
- First-child/next-sibling
- Folder hierarchy
- Forest traversal