Mathematics I / Computational Complexity
Practice question · Numerical answer

Binary search halves the remaining portion of a sorted list at each step. Starting from 1024 items, how many halvings reduce it to a single item?

Hints
  1. Ask what power of 2 gives 1024.
  2. 1024, 512, 256, ... keep going and count.
Show the answer

10

Why

210=10242^{10} = 1024, so ten halvings suffice. This is why logarithmic algorithms are so powerful: a thousandfold increase in data costs only ten extra steps.

Read the lesson: Computational Complexity →

Practise Computational Complexity

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

More questions on Computational Complexity