Skip to main contentSkip to solution

Binary search can only be applied to-

Solution

✅ Correct Option: 1

Binary search compares the target with the middle element and discards half of the list each time. This only works if the data is sorted (ascending or descending), because the order tells us which half can contain the target.


Options 3 and 4: binary search works for any length, since the middle element is chosen by integer division whether the length is even or odd.

Option 2: on unsorted data, the middle comparison says nothing about which half holds the target, so linear search is needed instead.

Keyboard Shortcuts

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