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
Real-world uses
- Choosing between sorting methods for large datasets and predicting app performance
Common mistake
Assuming a smaller O always means faster on small inputs.
How to learn this
- Read the key idea and say it in your own words.
- Work through the worked example, then try a similar problem.
- 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
- Strong Induction – Assume all earlier cases to prove the next.
- Well-Ordering Principle – Every nonempty set of positive integers has a least element.
- Partial Orders – Reflexive, antisymmetric, transitive relations.
- Cardinality of Sets – Comparing sizes of infinite sets.
- Countable and Uncountable Sets – ℕ and ℚ are countable; ℝ is not.
- Cantor’s Diagonal Argument – Proof that real numbers are uncountable.