The Escuela

← Analysis of Algorithms: all 3 parts

Computer science · Free practice

Analysis of Algorithms, Part 2: Nested Loops, Step by Step

Watch the lesson by Dr. J. Ubaldo Quevedo, then practice as many times as you want: every New button gives you a new loop or sum.

1. Watch

  • Write each line as a summation over the passes of its loop: Σi=0n−1 1 = n.
  • The inner loop's count goes inside the outer summation, then simplify from the inside out.
  • Two nested loops of n passes with one statement inside: 3 + 4n + 3n².

2. Try it yourself

Practice as many times as you want. Every New button builds a new loop or sum. It's free, and you don't need an account.

Correct so far: 0