Question 20

Consider the following statements about searching algorithms and choose the correct option.

  1. ASequential search requires the list to be ordered, while there is no such constraint for Binary search.
  2. BBinary search has time complexity of O(log₂ n), while sequential search has time complexity of O(n). Here, n is the number of elements in the list.
  3. CLink list is a suitable data structure for storing a list, and performing Binary search.
  4. DThe best case in Binary search is, when the key element exists in the begining of the list.
Show answerHide answer

Correct answer: (B) Binary search has time complexity of O(log₂ n), while sequential search has time complexity of O(n). Here, n is the number of elements in the list.

Explanation

Corrected: the book's key says (c), but (b) is the true statement. Binary search needs random access, so a linked list is unsuitable for it.

From DSSSB TGT Computer Science Practice Set 1

This is question 20 of DSSSB TGT Computer Science Practice Set 1. 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.