Specialty Digest

Global English editionLearners’ Study Dashboard — in development
The Knowledge Library for All

Online Courses / University Track / Computing Foundations

Module 5 · Lesson 2 · Core

Growth rates: constant, logarithmic, linear, quadratic

Recognise four common growth rates and predict what happens to the cost when n doubles.

  • 50 minutes
  • Serves O5
  • Assumes M5.L1

Phase 1: Prepare

Step 1 Warm-up recall

From M5.L1: how many pairs among 4 items?

Private: nothing you type here is sent or stored.

Step 2 Learning goal

By the end of this lesson you can:

  • name four growth rates (Foundation);
  • match a method to its growth (Core);
  • predict the effect of doubling n (Core).

Phase 2: Teach

Step 3 A familiar example

Reading the first item of a list costs the same however long the list is. Reading every item costs more as the list grows. Comparing every pair costs far more.

Step 4 Clear explanation

The growth rate of a method describes how its cost changes as n increases. Four patterns cover most methods you have met.

GrowthExample methodn = 10n = 100n = 1,000
ConstantRead the first item111
LogarithmicBinary search (about log base 2 of n)about 3about 7about 10
LinearLinear search (up to n)101001,000
QuadraticCompare every pair (about n squared)10010,0001,000,000

The table shows why growth matters more than small differences: at n = 1,000, binary search takes about 10 steps, linear search 1,000 and a pairwise comparison a million. To predict the effect of doubling, use the pattern in the figure.

ConstantsameLogarithmicone more stepLineardoublesQuadraticquadruples
Doubling the input: what happens to the cost.
Growthn = 100n = 200Ratio
Linear (n)1002002 times
Quadratic (n squared)10,00040,0004 times

Doubling the input doubles a linear cost but quadruples a quadratic cost, so a method that seems acceptable at 100 items can become very slow at 10,000. Organising the data differently, for example sorting it first, can change which growth rate applies, as binary search showed. See also the entry on the computer.

Step 5 Worked example (4 marks)

A pairwise comparison takes 10,000 comparisons at n = 100. Estimate the cost at n = 200.

  1. The growth is quadratic. (1 mark)
  2. Doubling n quadruples the cost. (1 mark)
  3. 10,000 × 4 = 40,000. (1 mark)
  4. Answer: about 40,000 comparisons. (1 mark)

Phase 3: Practise

Step 6 Learner practice (instant-marked)

1. Doubling n for a linear method does what to the cost?

2. Doubling n for a quadratic method does what to the cost?

3. Binary search is an example of which growth?

4. Which growth is slowest as n grows?

Phase 4: Close

Step 7 Recap

  • Constant, logarithmic, linear and quadratic are the common rates.
  • Doubling n doubles linear and quadruples quadratic cost.
  • Growth outweighs small differences in speed.

Step 8 Exit ticket (ungraded)

Name the growth of linear search, binary search and a pairwise comparison.

Private: nothing you type here is sent or stored.

Step 9 Go further (Extension)

Estimate the pairwise cost for n = 400 given 10,000 at n = 100.

Common mistakes

MistakeWhy it fails
Thinking quadratic means twice as slow when n doublesIt is four times as slow.
Ignoring growth for small testsPredict the large case.
Treating logarithmic as linearA million items need only about twenty looks.

Limits. The numbers are step counts for idealised methods; real speed also depends on hardware and data.