Skip to main content
impol.dev

Foundations

Complexity and constraints

Compare growth rates and use input constraints to reject approaches before coding.

Lesson 2/19

Sign in to watch

Sign in

Practice

Reference problems

0/2 solved

Notes

Lesson text

Complexity describes how resource use grows with input size. The lesson distinguishes Big O, Big Omega, and Big Theta, then connects common growth rates to code and practical constraints.

Use Big O for an upper bound, Big Omega for a lower bound, and Big Theta for a tight bound.

Recognize O(1), O(log n), O(sqrt n), O(n), O(n log n), O(n^2), O(2^n), and O(n!) code shapes.

Estimate both time and extra space, then compare the result with the allowed input size.

Growth-rate ladder

Constant factors are ignored in asymptotic notation, so Theta(n / 2) simplifies to Theta(n). Nested loops, repeated branching, and permutation generation grow much faster than logarithmic or linear work.

Constraint check

Read the constraints first. A coding-platform heuristic is that roughly 10^7 simple operations may be manageable, while an input near 10^9 usually demands a sublinear approach such as binary search.