Ages 16–18 · A Level · Foundation
Triangular loop with a constant bound
Use the evidence in triangular loop with a constant bound to select and justify a valid solution.
Understand the idea
Complexity describes growth with input size rather than one timing result.
Your challenge
For each i=1..n a second loop runs j=1..min(i,5). What is total asymptotic work as n grows?
- O(n squared) because every nested loop is quadratic
- O(1) because five is fixed
- O(n) because at most five inner steps occur per outer step
How to explore
- Distinguish a bounded inner range from one that continues growing with n.
- Record the state after each executed operation, respecting the stated evaluation and stopping rules.
- Check the selected response against the complete situation, including a case where a tempting alternative fails.
Open the activity to work with its controls and check your reasoning. Progress stays in this browser.
Keep exploring
DON’T LET THE QUESTION END HEREGive that curiosity
Open the learning space