Skip to main contentSkip to solution

How many comparisons will be required by a linear search algorithm, if the element being searched is not present in the list of n elements?

Solution

✅ Correct Option: 1

Linear search compares the target with each element one by one from the start. If the element is absent, it is compared with every one of the nn elements before the search can conclude it is not there.

Number of comparisons =n= \boxed{n}


Option 3: 1 comparison is the best case, when the element is the first one in the list.

Option 4: log⁡2n\log_2 n comparisons is the worst case of binary search, which needs a sorted list.

Keyboard Shortcuts

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