Which of the following is a disadvantage of linear search?
2023
Which of the following is a disadvantage of linear search?
- A.
Requires more space
- B.
Greater time complexities compared to other searching algorithms
- C.
Not easy to understand
- D.
Not easy to implement
Attempted by 149 students.
Show answer & explanation
Correct answer: B
Concept: Time complexity measures how the running time of a search algorithm grows with the number of elements n. A sequential scan that checks elements one at a time has worst-case time complexity O(n), while algorithms that exploit sorted order or indexing (for example binary search) run in O(log2 n), and hashing runs in O(1) on average.
Applying it here: Linear search has no precondition on the data (it need not be sorted) and touches at most n elements using a single loop, so its worst-case cost is O(n) comparisons — strictly worse than binary search's O(log2 n) on the same n. This higher time complexity relative to other searching algorithms is exactly the disadvantage being asked about.
Why the other listed traits are not disadvantages:
Space — linear search tracks only a single loop index while comparing elements in place, i.e. O(1) auxiliary space; it needs no extra arrays, indexes, or auxiliary structures, so it is not space-hungry.
Understandability — checking each element in turn is about as direct as an algorithm gets, with no sorting rule, partitioning scheme, or hashing logic to learn first.
Implementation — it needs only one loop and one comparison per step, with no recursion, midpoint arithmetic, or preprocessing.
Cross-check: For n = 1,000,000 elements, linear search may need up to a million comparisons in the worst case, while binary search needs only about log2(1,000,000) ≈ 20 comparisons — confirming the O(n) vs O(log2 n) gap is a real, quantifiable drawback, not the space, clarity, or implementation traits.
The disadvantage of linear search among the given options is therefore its greater time complexity compared to other searching algorithms.