The complexity of linear search algorithm is :
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.
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.
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.