Skip to main contentSkip to solution

Consider a list of 10 elements: L=[2, 63, 5, 47, 9, 11, 13, 17, 7, 23].

Determine the number of comparisons to search for a key 13 using linear search.

Solution

✅ Correct Option: 2

Linear search compares the key with each element from the start, one by one, until it finds a match.

ComparisonElementEquals 13?
12No
263No
35No
447No
59No
611No
713Yes

So 13 is found at the 7th position, after 7\boxed{7} comparisons.


Option 1: 6 is the index of 13 (counting from 0), not the number of comparisons.

Option 3: linear search does not need a sorted list, so the order does not matter.

Option 4: sorting is needed for binary search, not for linear search.

Keyboard Shortcuts

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