Mathematics I / Computational Complexity
Practice question · Put in order

Order these complexity classes from the slowest-growing to the fastest-growing.

Hints
  1. Compare how each behaves as n gets very large, not on small inputs.
  2. One class does not grow at all; one doubles with every extra element.
Show the answer
  1. Constant
  2. Logarithmic
  3. Linear
  4. Quadratic
  5. Exponential
Why

Constant, logarithmic, linear, quadratic, exponential is the standard ladder. The gaps are enormous: at n = 1,000,000 the linear algorithm does a million steps and the quadratic a trillion, while the exponential one is hopeless well before n = 100.

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