Engrain by ByteRush

DSA.10.03 Mid-level

Pattern 13: Binary search trees

Comes up in: DSA

This concept is being written. It gets the full five steps — explanation, predict, interview angle, practice with tests, and review cards. Here is exactly what it will cover, so you can study it elsewhere in the meantime.

What it covers

  • validating with bounds
  • in-order gives sorted order
  • k-th smallest
  • LCA using BST ordering

Words you will know

in-order traversalBST invariant

What you will practise

  • validate-bst (M)
  • kth-smallest-bst (M)
  • lca-bst (M)

Interview questions this answers

  • Validate a BST. Why is checking only the children wrong?