LearnViz Math
Expert ⛓ Discrete Math & Number Theory Topic 102 of 103

Algorithm Complexity (Big-O)

How running time grows with input size.

Key idea

How running time grows with input size.

In depth

Big-O describes how running time grows with input size, ignoring constants: O(1), O(log n), O(n), O(n log n), O(n²), O(2ⁿ). It compares algorithms at scale.

Worked example

Binary search is O(log n); scanning a list is O(n); nested loops over n items are O(n²).

Formula

O(n log n)

Real-world uses

Common mistake

Assuming a smaller O always means faster on small inputs.

How to learn this

  1. Read the key idea and say it in your own words.
  2. Work through the worked example, then try a similar problem.
  3. Use the interactive lesson’s visual and mini-quiz to check the pattern.

Frequently asked questions

What is Algorithm Complexity (Big-O)?

How running time grows with input size. It is a topic at the expert level in Discrete Math & Number Theory.

What is the formula for Algorithm Complexity (Big-O)?

The key formula is O(n log n).

Where is Algorithm Complexity (Big-O) used in real life?

Real-world examples: Choosing between sorting methods for large datasets and predicting app performance.

What should I learn before Algorithm Complexity (Big-O)?

Make sure you are comfortable with Finite Automata, the previous topic in Discrete Math & Number Theory.

What is a common mistake with Algorithm Complexity (Big-O)?

Assuming a smaller O always means faster on small inputs.

How can I practise Algorithm Complexity (Big-O)?

Open the interactive lesson, play with the visual, then answer the three-question mini-quiz. Getting two right marks the topic complete.

What comes after Algorithm Complexity (Big-O)?

Move on to Sorting Algorithm Analysis next.

Related expert topics in Discrete Math & Number Theory