LESSON 3.13 · 5 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW
Big-O and growth rates
Count the steps of three duplicate checks as the list grows.
Pro lesson. Stage 1 is free to watch. Pro opens all 5 stages, 3 controls and 3 checks, in this lesson and every other.
Go Pro · $8.25/moEXPLAINER · 3.13 · GROWTH BAYall pairs · n = 8 · T = 28 steps
01
Stage 1 of 5 · Count the steps
Time complexity counts steps as n grows. With no match, the worst case, all pairs takes 28 steps.
Explain it simply
You want to know if a list holds the same number twice. All pairs compares each item with every item after it. Each small square is one comparison, or one step. Count them: 28 steps for 8 items.
All pairs runs on 8 items. It takes 28 steps, one square per step, in 7 rows. It finds no match.
input itemstep, memory cell, c·g(n)real run, matchmore steps than all pairsindex or item on the diagonal
Toy: 2 to 16 two-digit numbers · 3 duplicate checks · every step counted
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
T of n counts the steps of one run on n items.
PRO LESSON · YOU WATCHED STAGE 1 OF 5
Unlock the full explainer
- 4 more stages and 3 live controls
- 2 mix-up cards and 3 predict-then-reveal checks
- Watch it as a narrated video, in three voices
- Every Pro lesson and capstone · 656 in total
$99 a year, or $15 a month. Cancel any time.