Data Structures19 sections · 729 units
Open in Course

Section Recap

What you learned

Binary trees: each node has at most two children. Traversals: Preorder (root-left-right), Inorder (left-root-right), Postorder (left-right-root).

All O(n)O(n). Patterns:

  • Recursion with base case (null node)
  • Pass information down (target sum) or up (height)
  • Build trees from traversal pairs

Common Problems: Max depth, path sum, LCA, serialization. Time: O(n)O(n). Space: O(h)O(h) where hh is height.