Roadmap › Stage 6: Trees › Pattern 30 of 53
DSA pattern guide

Binary Search Tree

Sorted tree: search, insert, validate, kth smallest.

Stage 6 · Trees11 problems2 Easy · 8 Medium · 1 Hard

Use it when

Sorted tree: search, insert, validate, kth smallest.

Key idea

Left < node < right. Inorder traversal gives sorted order, and each step discards half the tree.

Practice problems, in order

  1. Convert Sorted Array to BSTEasy
  2. Search in a BSTEasy
  3. Insert into a BSTMedium
  4. Validate Binary Search TreeMedium
  5. Delete Node in a BSTMedium
  6. Kth Smallest Element in BSTMedium
  7. Convert BST to Greater TreeMedium
  8. Binary Search Tree IteratorMedium
  9. Lowest Common Ancestor of BSTMedium
  10. Recover BSTMedium
  11. Maximum Sum BST in Binary TreeHard

How to practise this pattern

  1. Read the problem and look for the signal above before writing any code.
  2. Say the brute force out loud, with its time complexity, then ask what work it repeats.
  3. Apply the key idea and write the optimised version yourself.
  4. If you're stuck for more than 10 minutes, take one small hint, not the full solution.
  5. Move to the next problem only when you can explain why this pattern fits.

Stuck on one of these?

The AlgoSolveo extension (free, launching soon) sits beside the LeetCode problem and gives the smallest hint that gets you moving, never the full answer. Solved problems tick off on your roadmap.

Join the extension waitlistTrack it on the roadmap
← Previous patternTree — LCA & ConstructionNext pattern →Heap — Top K Elements