Learn

Learning preferences

Make learning more comfortable. Changes apply immediately.

Enlarges page content, including diagrams and their labels. You can also use your browser’s zoom.

Choose the colours that are easiest for you to distinguish. Applies to lesson diagrams and lab plots. Labels, shapes, hatching and line patterns also distinguish meanings. Source photographs and raw image brightness stay unchanged; mask-only views are available for image overlays.

ExampleComparisonSample link

Saved in this browser on this device. Preferences are separate from progress backups.

Lesson 15 of 18

Separate a growth bound from a timing claim

Use quantified O, Ω and Θ definitions and count operations.

Loading your saved responses…

Try

An algorithm examining every ordered pair of n entries performs n² pair examinations. Another making one pass performs n. A graph of measured seconds may be noisy, but the operation counts reveal a mathematical growth distinction.

Predict

Predict the meaning of an upper bound. For nonnegative functions eventually, f=O(g) means constants C>0 and n₀ exist with f(n)≤Cg(n) for all n≥n₀. Ω supplies a lower bound; Θ supplies both. The constants cannot change with n.

Experiment

Compare n, n log₂n and n² at n=8,16,32 using exact values for these powers of two. Identify which ratios stay constant and which grow. This table suggests a conjecture; use quantified inequalities to establish an asymptotic claim.

Understand

Worked bound: for n≥1, 3n²≤3n²+2n+7≤12n². Thus the expression is Θ(n²) with explicit constants 3 and 12. To prove n² is not O(n), suppose n²≤Cn eventually. Dividing by positive n gives n≤C, contradicted by choosing a larger integer.

Loop structure must be counted before classified. A triangular nested loop with inner counts 1,2,…,n performs n(n+1)/2 operations, still Θ(n²), not exactly n². A doubling loop from 1 takes ceil(log₂n) doublings to reach at least n for n≥1.

Invalid interpretation: O(n²) says the program takes n² seconds. It specifies an eventual bound on a declared cost function, not hardware timing or an exact formula.

Apply

Name the input size and counted operation, and distinguish worst-case from a specific trace. An O(n³) bound on n² is true but loose. A claim of Θ requires both sides, and testing finitely many inputs cannot establish an eventual universal statement.

Continue

Depth: recurrence methods and amortized analysis explain algorithms whose local costs vary. Randomized expected costs need a stated probability model. Computational complexity theory compares problem families, not only a few implementations on one machine.

Compare counted operations in the algorithmic growth investigation.

Apply · explain · revise

Practice and reasoning

Drafts save locally as you type. Reveal worked solutions when useful; the site remembers that exposure. Automatic matches check the requested answer, while written arguments require review against the rubric.

A loop examines every ordered pair of distinct indices from an array of length 9. How many pair examinations?

Integers, fractions and finite decimals are accepted. Expressions such as sqrt(2) are not parsed by this checker.

For input n=32, a loop doubles k from 1 while k<n. How many doublings?

Integers, fractions and finite decimals are accepted. Expressions such as sqrt(2) are not parsed by this checker.

The statement f(n)=Θ(n²) means:

Your response

Which is a valid but not tight upper bound for n² as n→∞?

Your response

Prove 3n²+2n+7=Θ(n²) for positive integer n by giving explicit constants.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

Prove n² is not O(n) on the positive integers.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

Reflect and continue

Before marking this lesson complete, explain one key idea without the worked solution and identify a condition that matters. Marking complete records participation, not independent mastery.