Question 45

The complexity of linear search algorithm is :

  1. AO (n log n)
  2. BO (n)
  3. CO (log n)
  4. DO (n*n)
Show answerHide answer

Correct answer: (B) O (n)

Explanation

Linear search may have to check every one of the n elements in the worst case, so it takes O(n) time.

From DSSSB TGT Computer Science Practice Set 1

This is question 45 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.