Skip to content

Study guides & original practice

Big O loop practice

Big O describes an upper bound on how computational work grows with input size. It does not directly tell you elapsed seconds on a particular computer.

By ExamCat · Original study lesson · Published September 24, 2026

Understand the method

Count how many times the relevant operation runs as n grows. Consecutive loops add work; nested loops can multiply it. Loop bounds and changes to the counter matter more than the visual presence of a loop keyword.

Worked example, step by step

An algorithm has an outer loop running n times and an inner loop running n times for every outer iteration.

  1. The inner operation runs n times for one outer iteration.
  2. There are n outer iterations, giving n × n operations.
  3. The work grows quadratically, Θ(n²) under this model and therefore O(n²).
  4. For n = 10 the operation runs 100 times; for n = 20 it runs 400 times.

A mistake to watch for

Two loops one after the other are not automatically quadratic. A pair of n-step loops performs approximately 2n operations, which grows linearly.

Try it yourself: three questions

Write an answer before opening the explanation. For calculations, keep your units and intermediate steps; for concepts, state the reason for your choice.

1. One loop runs n times and a second runs 5n times. What growth class describes their total?

Show answer and explanation

Linear, O(n), because 6n differs from n by a constant factor.

2. An inner loop always runs three times inside an n-step outer loop. What growth?

Show answer and explanation

Linear, O(n). The inner bound is constant rather than proportional to n.

3. A positive counter doubles until reaching n. What growth in iteration count?

Show answer and explanation

Logarithmic, O(log n), assuming fixed-cost work per iteration. Repeated doubling reaches n in logarithmically many steps.

Build your next practice session

Mark the first step where your reasoning differed from the explanation. Turn that step into a question, answer it without looking, then change one condition in the example and explain what would change. A correct guess is a reason to revisit the method.

Use the free flashcard maker for your own question-and-answer pairs, or bring your course material into PDF-to-flashcards practice.

Further reading

OpenStax: data structures and algorithms provides textbook background. The worked scenario and practice questions on this page were written independently for ExamCat.

Related lessons

Browse this subject in the Blog ↗

Practice your own class material

Generate flashcards, notes and quizzes from your lecture notes in Exam Cat.

Try 7 days free ↗

Yearly plan: 7 days free, then $39.99/year. Cancel before the trial ends to avoid a charge.

APUSH study guide · Biology study guide · APUSH practice · All study tools