LESSON 08 / 75·2 min readIntermediate

Trees and binary search trees

Must knowConcept lesson
01 Understand02 Recall03 Prepare

Binary tree

Each node has at most two children.

Problems to practice

  • Inorder traversal
  • Preorder traversal
  • Postorder traversal
  • Level order traversal
  • Height of tree
  • Diameter of binary tree
  • Lowest common ancestor
  • Validate BST
  • Symmetric tree
  • Path sum

Binary search tree

Left subtree smaller, right subtree larger.

Problems to practice

  • Insert, search, delete
  • Kth smallest element
  • Inorder traversal gives sorted order
  • Lowest common ancestor in BST

Patterns

  • DFS recursion
  • BFS queue
  • stack for iterative traversal

PAUSE & RECALL

Can you explain it without the notes?

Trees and binary search trees

Use your own words. Explain an example and one limitation before checking the explanation.

Check your explanation

Binary tree

CONNECT IT TO YOUR INTERVIEW

Turn this concept into a clear answer.

Practice this concept
YOUR NEXT STEP

Keep connecting the ideas.

Next lesson: Heap and priority queue

Adapted from 14_DSA_MASTER.md · “8. Trees and binary search trees”. Examples are study fragments; framework behavior can depend on your version.