Computer Science I / Searching Strategies
Practice question · Select all that apply

Select every true statement about binary search.

Hints
  1. Separate the properties of binary search from those of linear search.
  2. 'Works on any collection' is linear search's advantage, not binary search's.
Show the answer
  • A. Binary search requires the data to be sorted.
  • C. Scanning from one end costs O(log n) when the item is last.
  • D. Sorting first pays off when many searches will follow.
  • E. Unsorted data is no obstacle to a linear scan.
Why

Binary search needs sorted data and random access, halves the range each step, and is O(log n). Working on any unsorted collection describes linear search, which is the option that does not belong.

Read the lesson: Searching Strategies →

Practise Searching Strategies

The app has 7 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.

More questions on Searching Strategies