Consider a list of 11 elements:
7, 12,13, 18, 46, 24, 30, 32, 14, 43, 38.
Determine the number of comparisions linear search makes to search for key = 18.
Consider a list of 11 elements:
7, 12,13, 18, 46, 24, 30, 32, 14, 43, 38.
Determine the number of comparisions linear search makes to search for key = 18.
Solution
✅ Correct Option: 2
Linear search checks elements one by one from the start, and stops as soon as the key is found.
| Comparison | Element | Equal to 18? |
|---|---|---|
| 1 | 7 | No |
| 2 | 12 | No |
| 3 | 13 | No |
| 4 | 18 | Yes |
The key is found at the 4th position, so the search makes comparisons.
Option 1: 3 is the zero-based index of 18, not the number of comparisons. The count equals position (index + 1).
Related questions:
2025: 27 May Shift 2
2025: 16 May Shift 1
2026: 23 May Shift 2
2026: 18 May Shift 2
2025: 21 May Shift 1
2026: 18 May Shift 2