Learning objectives
Write nested loops and trace them by hand, recording both loop control variables, and predict the exact output, such as a triangle of characters or a multiplication table
Calculate how many times a statement inside nested loops executes, multiplying the counts when the bounds are independent and adding row by row, for example to n(n + 1)/2, when the inner bound depends on the outer variable
Compare two code segments that solve the same problem by their statement execution counts, and state which does less work as the size of the input grows
Move an inner loop into a helper method called from the outer loop, and explain how this makes the algorithm easier to read and to test
Continue with a revision plan
These learning objectives are available to everyone. Sign in with an eligible plan to read the full note and worked examples.
