Skip to content
dsa/roadmap
← All chapters
Chapter 06Weeks 9–10Phase 2 ~3.7 h

Trees

Binary trees and BSTs: insert, search, delete, traversals, and general trees.

  1. 6.1Binary Trees & Tree TermsRoot, parent, child, leaf, sibling, depth, height, level, subtree; full, complete and perfect binary trees; and the Node struct with recursive count and height. 45 mineasy
  2. 6.2Binary Search TreeLeft is smaller, right is bigger. Insert, search, find min and max by walking one path, and why the tree's shape decides whether that is O(log n) or O(n). 55 minmedium
  3. 6.3BST Delete (3 Cases)Deleting a leaf, a node with one child, and a node with two children by copying the inorder successor. The most-asked BST exam question. 45 minhard
  4. 6.4Tree TraversalsPreorder, inorder and postorder (depth-first, recursive) and level order (breadth-first, with a queue). Know them by hand and in code. 45 minmedium
  5. 6.5General Trees (Left-Child, Right-Sibling)Trees where a node can have any number of children, stored with only two pointers per node using the left-child/right-sibling representation. 30 minmedium

Keyboard shortcuts

⌘K /
Search topics, glossary, cheat sheets
space
Play / pause the visualizer
← →
Step back / forward
r
Reset the visualizer
?
Show this help