Consiser the following linear list 'L':
L=[11,32,17,19,23,29,42]
Determine the number of comparisons a linear search will take to search for key 42.
Consiser the following linear list 'L':
L=[11,32,17,19,23,29,42]
Determine the number of comparisons a linear search will take to search for key 42.
Solution
✅ Correct Option: 4
Linear search checks the elements one by one from the start, and stops only when it finds the key.
The key 42 is the last element, at position 7 (index 6), so it is compared with every element in the list.
In linear search, the number of comparisons for a key equals its position (counting from 1), not its index.
Related questions:
2026: 26 May Shift 1
2026: 20 May Shift 1
2026: 29 May Shift 1
2026: 18 May Shift 2
2026: 23 May Shift 1