JC • H2 Computing
Loop Cost
Count operations, classify growth and optimise loops.
Round 1/6
Score: 0
Operation counting
Nested-loop grid
Each filled cell represents one execution of the counted statement. The figure uses a small sample size.
Operation budget
Investigate the loop
Live growth plot
The idea
Count how often the marked statement executes, not how many conditions are tested. Sequential loop costs add. Nested loop costs depend on how many inner iterations occur for each outer iteration. The highest-order growth term determines Big-O.