DSA Pattern Guide

Trees & BSTs Interview Patterns

Tree interview problems are almost always a traversal (DFS pre/in/post-order or BFS level-order) combined with what you track along the way — a running sum, a depth, a pair of ancestors. BST problems add one fact: in-order traversal of a BST visits nodes in sorted order, which is the key insight behind most BST-specific questions.

5
Problems in Ediky's DSA bank
17
Questions in Ediky's DSA-Technical bank
5 problems is thin for a topic this central to interviews — being upfront about that rather than overselling it. The DSA-Technical bank's 17 questions are the deeper resource for now. Ediky also doesn't split out a separate "BST" tag from general "Tree" yet, so BST-specific problems aren't independently filterable.

The patterns that matter

  • DFS traversal (pre/in/post-order) — the default tool for most tree problems
  • BFS / level-order traversal — when the answer depends on depth or level
  • In-order traversal on a BST — visits nodes in sorted order; the basis for most BST-specific questions
  • Tracking state through recursion — running sums, ancestor chains, subtree properties

Real problems from Ediky

From the DSA bank (code-judged):

  • "Disk Storage" (Tree)
  • "Building Monuments" (Tree)
  • "Longest Compatible Transmission Path" (Tree)

Practice Tree problems

5 code-judged Tree problems, plus 17 deeper trace/MCQ questions in DSA-Technical.

Open Tree problems