Skip to main contentSkip to solution

When an element to be searched is present at one of the following positions in an unsorted list, then which situation(s) will take the least number of comparisons?

(A). mid position

(B). first position

(C). last position

(D). not present

Solution

✅ Correct Option: 3

In an unsorted list, linear search checks elements one by one from the start. If the element is at the first position, it is found in just 1 comparison, which is the minimum possible (best case).

Position of elementComparisons for a list of nn elements
(B) First1
(A) Midabout n2\dfrac{n}{2}
(C) Lastnn
(D) Not presentnn

Options 1 and 4: (D) is the worst case, since every element must be checked before concluding the item is absent. (C) is also a worst case, needing nn comparisons.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question