What is the maximum possible height of a Binary Search Tree containing n nodes?

Options

  • A. O(log n)
  • B. O(n)
  • C. O(1)
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. O(n)

Detailed Explanation

The maximum height of an ordinary Binary Search Tree containing n nodes can be O(n). This occurs when the tree becomes completely skewed, meaning each node has only one child. For example, inserting already sorted values into a basic BST can produce such a structure. In contrast, a well-balanced BST has height O(log n). Therefore, BST performance depends strongly on tree height, which is why self-balancing BSTs are important.