Question 55

Computer Awareness Searching Medium

What is the worst-case time complexity of linear search algorithm?

(A) \( O(n) \)
(B) O (i)
(C) O(logn)
(D) \( O\left(n^2\right) \)
View Dynamic Solution & Explanation
Correct Solution: Option A

Step-by-step Solution:

In a linear search algorithm, each element of the array is checked sequentially until the target element is found or the entire array is traversed. In the worst-case scenario, the target element is either at the end of the array or not present at all. Thus, the time taken is proportional to the size of the array ((n)). \[\] Correct Option: (a)