Tree Fundamentals
Tree properties (N-1 edges, unique paths), rooting trees, parent/child relationships, and tree traversals.
Lessons
1. Intro
Formal Definition
2. Visualizing a Tree
Gravity matters
3. Rooting the Tree
Changing perspective
4. Moving in a Tree
DFS Simplification
5. Tree DFS Template
The Parent Pointer
6. Concept - Depth vs Height
Measuring distance
7. Quiz: Tree Properties
Knowledge check
8. LeetCode 104 Maximum Depth of Binary Tree - Problem Statement
LeetCode 104
9. LeetCode 104 Maximum Depth of Binary Tree - Strategy
Recursive Definition
10. LeetCode 104 Maximum Depth of Binary Tree - Implementation
Coding it
11. Concept - Tree Dynamic Programming
The Pattern
12. CSES 1674 Subordinates - Problem Statement
Count employees under each manager
13. CSES 1674 Subordinates - Strategy
Team size calculation with DFS
14. CSES 1674 Subordinates - Implementation
Code solution
15. Quiz: Subtree Size Computation
Knowledge check
16. Concept - Tree Diameter
Longest path in a tree
17. LeetCode 543 Diameter of Binary Tree - Problem Statement
Find the diameter of a binary tree
18. LeetCode 543 Diameter of Binary Tree - Strategy
Every path has a highest point
19. LeetCode 543 Diameter of Binary Tree - Implementation Details
Recursive height with diameter update
20. LeetCode 543 Diameter of Binary Tree - Takeaway
Pattern lesson
21. Quiz: Tree Diameter
Knowledge check
22. Concept - General Tree Diameter
Double BFS for general trees
23. CSES 1131 Tree Diameter - Problem Statement
Tree Diameter (CSES)
24. CSES 1131 Tree Diameter - Double BFS Algorithm
Pick node, find furthest, repeat
25. CSES 1131 Tree Diameter - Why Double BFS Works
Intuition behind the algorithm
26. CSES 1131 Tree Diameter - Two Approaches Compared
DP vs Double BFS
27. Concept - Tree Centers
Node minimizing max distance
28. LeetCode 310 Minimum Height Trees - Problem Statement
Find roots that minimize tree height
29. LeetCode 310 Minimum Height Trees - Strategy
Topological peeling algorithm
30. LeetCode 310 Minimum Height Trees - Implementation
BFS-like leaf removal
31. Quiz: Tree Centers
Knowledge check
32. LeetCode 100 Same Tree - Problem Statement
Check if two trees are identical
33. LeetCode 100 Same Tree - Strategy
Compare nodes recursively
34. LeetCode 100 Same Tree - Algorithm
Recursive comparison logic
35. LeetCode 100 Same Tree - Implementation
Code solution
36. LeetCode 100 Same Tree - Lessons
Key patterns for tree comparison
37. Quiz: Tree Comparison
Knowledge check
38. LeetCode 226 Invert Binary Tree - Problem Statement
Mirror a binary tree
39. LeetCode 226 Invert Binary Tree - Strategy
Swap children recursively
40. LeetCode 226 Invert Binary Tree - Algorithm
DFS inversion approach
41. LeetCode 226 Invert Binary Tree - Implementation
Code solution
42. LeetCode 226 Invert Binary Tree - Lessons
Tree modification patterns
43. Quiz: Tree Inversion
Knowledge check
44. Section Recap
Trees are mastered