Skip to main contentSkip to solution

Given a list L=[5,6,75,85,95]

If we need to search for the element 85, then how many comparisons will it make to find the element using linear search?

Solution

✅ Correct Option: 3

Linear search checks elements one by one from the start of the list until it finds a match. It compares 85 with 5, 6, 75 and then 85, so the search stops at the 4th element after 4 comparisons.


Option 2: 3 is the index of 85 (counting from 0), but the number of comparisons is the position, which is index + 1.

Option 4: 5 is the length of the list, which is the worst-case count. The search stops as soon as 85 is found, so 95 is never compared.

Keyboard Shortcuts

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