Coding & Algorithms (DSA)

Trees & BST

6 practice questions. Free questions open a full answer guide; the rest unlock with Pro.

  • Which traversal of a binary search tree visits the keys in sorted order, and how does that traversal work? Junior level
  • A teammate validates a binary search tree by checking, at every node, that its left child is smaller and its right child is larger. Their code passes the obvious tests but is wrong. What's the flaw, and how do you validate a BST correctly?Go Pro Senior level
  • Why does an in-order traversal of a binary search tree produce keys in sorted order, and how would you use that to validate that a tree is actually a correct BST?Go Pro Mid level
  • What property defines a binary search tree, and what are the time complexities of search, insert, and delete?Go Pro Junior level
  • A colleague ships a plain binary search tree as an in-memory index. It's fast in testing but crawls in production. What could cause a BST to degrade to O(n) lookups, and what do you reach for instead?Go Pro Mid level
  • Why does a plain binary search tree degrade to O(n) operations in the worst case, and what do self-balancing trees actually change to restore the O(log n) guarantee you were counting on?Go Pro Senior level
Want questions matched to your role? Paste a job title, job description, or CV for a personalized set, or go Pro to unlock the full bank.