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?
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 elements before the search can conclude it is not there.
Number of comparisons
Option 3: 1 comparison is the best case, when the element is the first one in the list.
Option 4: comparisons is the worst case of binary search, which needs a sorted list.
Related questions:
2026: 24 May Shift 1
2025: 16 May Shift 1
2025: 21 May Shift 1