If the key is absent, how many comparisons does linear search make?
Asix comparisons
Bn comparisons
Cone comparison
Dtwo comparisons
Answer & Solution
Correct answer: B. n comparisons
1. The search cannot conclude absence until the list is exhausted.
2. Every element has to be tested.
3. If the key is not present, linear search has to make n comparisons.
4. That is the same as the worst successful case.
_Source: syllabus Computer Science, Ch 5 'Sorting' and Ch 6 'Searching'_
Keep practising Sorting and Searching
Browse all Sorting and Searching questions for IGNOU MCA, or explore more Computer Science topics.