Question 43

The worst case complexity for searching an element in binary search tree is:

  1. AO(lgn)
  2. BO(nlgn)
  3. CO(n²)
  4. DO(n)
Show answerHide answer

Correct answer: (D) O(n)

Explanation

A skewed (degenerate) BST is like a linked list, so a search may have to visit all n nodes: O(n) in the worst case.

From DSSSB TGT Computer Science Practice Set 2

This is question 43 of DSSSB TGT Computer Science Practice Set 2. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.