If a linear search is performed on 10 elements, how many comparisons will be needed in worst case?
If a linear search is performed on 10 elements, how many comparisons will be needed in worst case?
Solution
✅ Correct Option: 2
In linear search, each element is compared with the key one by one. The worst case occurs when the key is at the last position or is not in the list at all, so every element is checked once.
For elements, the number of comparisons is .
Option 1: this is the best case, where the key is the first element.
Options 3 and 4: off-by-one errors. Each element needs exactly one comparison, so the count is , not or .
Related questions:
2026: 26 May Shift 1
2026: 23 May Shift 1
2026: 29 May Shift 2
2025: 27 May Shift 2
2025: 16 May Shift 1