What is a binary search tree (BST)?

Quick Overview

Asks what a binary search tree is and to state its ordering rule precisely. Tests whether you can explain search, insertion and deletion costs in terms of tree height, handle duplicate keys, and recognize when the tree degenerates.

What is a binary search tree (BST)?

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: easy

Interview Round: Other

What is a binary search tree (BST)? Explain the ordering rule that defines it. ```hint Parent or subtree? Decide whether the ordering rule compares a node with its children only or with everything below it, then test your answer on a three-level tree. ``` ### What a Strong Answer Covers - States the ordering rule precisely, including how far below a node it applies. - Says how duplicate keys are handled. - Explains how the cost of search, insertion and deletion depends on the tree's shape. - Explains what an in-order traversal produces. - Mentions how degenerate trees are avoided in practice. ### Follow-up Questions - How would you check whether a given binary tree is a valid BST? - How do you delete a node that has two children? - Insert 1, 2, 3, 4 and 5 in that order into an empty BST. What shape do you get, and how does a balanced tree avoid it? - When would you choose a BST over a hash table?

Overview: Asks what a binary search tree is and to state its ordering rule precisely. Tests whether you can explain search, insertion and deletion costs in terms of tree height, handle duplicate keys, and recognize when the tree degenerates.

PracHub logo
General
Nov 25, 2026
easySoftware EngineerOtherSoftware Engineering Fundamentals
0
0

What is a binary search tree (BST)? Explain the ordering rule that defines it.

What a Strong Answer Covers Guidance

  • States the ordering rule precisely, including how far below a node it applies.
  • Says how duplicate keys are handled.
  • Explains how the cost of search, insertion and deletion depends on the tree's shape.
  • Explains what an in-order traversal produces.
  • Mentions how degenerate trees are avoided in practice.

Follow-up Questions Guidance

  • How would you check whether a given binary tree is a valid BST?
  • How do you delete a node that has two children?
  • Insert 1, 2, 3, 4 and 5 in that order into an empty BST. What shape do you get, and how does a balanced tree avoid it?
  • When would you choose a BST over a hash table?