
Technology • 60 • 25 students • Created with AI following Aligned with New Zealand Curriculum
Free PDF · we'll email you a copy
Create a 60-minute Year 13 NZ Digital Technologies / computer science lesson on algorithm efficiency and optimisation. The lesson should recap Big O notation, explicitly discuss dropping constant factors and why asymptotic analysis does this, then walk students through recursive Fibonacci in Python, compare it with an optimal iterative or dynamic-programming implementation, and use profiling/timing to gather evidence. Include clear learning intentions and success criteria, worked Python code for both approaches, teacher modelling, paired coding/investigation tasks, predicted misconceptions, differentiation, formative assessment questions, and an exit ticket. Emphasise interpreting runtime growth rather than relying only on one benchmark. Align where appropriate to NCEA Digital Technologies AS91898 (computer science concept) and AS91906 (complex programming techniques).
Students investigate why algorithm efficiency matters by revisiting Big O notation, analysing recursive Fibonacci in Python, and comparing it with iterative and dynamic-programming solutions. They use timing evidence to interpret growth across input sizes, rather than treating one benchmark as a complete performance judgement.
0–7 min · Hook and retrieval. Display the opening runtime-growth question and ask, “Which is faster: an algorithm taking (n) steps or one taking (1,000n) steps?” Students complete the first section of the algorithm efficiency investigation sheet from memory: define Big O, rank (O(1)), (O(\log n)), (O(n)), (O(n\log n)), (O(n^2)), and identify one real-world reason efficiency matters.
7–17 min · Explicit teaching. Use the Big O explanation slides to recap that Big O describes how resource use grows as input size increases, not an exact stopwatch time. Model (T(n)=3n^2+20n+7): the (n^2) term dominates for large (n), so the classification is (O(n^2)). Explicitly discuss dropping constants: (O(2n)), (O(100n)) and (O(n)) have different practical speeds but the same long-run growth pattern; asymptotic analysis ignores constant factors to compare scalability across machines and implementations. Students annotate the worksheet and answer: “When might a constant factor still matter?”
17–27 min · Teacher modelling: recursion. Open the Fibonacci trace and code slides and live-code or display:
def fib_recursive(n):
if n <= 1:
return n
return fib_recursive(n - 1) + fib_recursive(n - 2)
print(fib_recursive(10))
Trace fib_recursive(5) with students, highlighting repeated calls such as fib(3) and fib(2). Explain that the branching produces approximately exponential growth, commonly described as (O(2^n)), while the call stack uses (O(n)) space. Students predict which values will become slow and record one reason repeated work occurs.
def fib_iterative(n):
a, b = 0, 1
for _ in range(n):
a, b = b, a + b
return a
def fib_dp(n):
values =
for i in range(2, n + 1):
values.append(values[i - 1] + values[i - 2])
return values[n]
Students verify outputs against one another before timing. They should test a safe range such as `` for recursion and a larger range for the efficient methods. They record correctness, runtime, input size and observations in the timing table and analysis questions. Circulate and ask: “What must remain constant for this comparison to be fair?” and “What pattern would convince you that growth is exponential rather than merely slow?”
from time import perf_counter
def average_time(function, n, repeats=5):
start = perf_counter()
for _ in range(repeats):
function(n)
return (perf_counter() - start) / repeats
Students time each algorithm several times, use matching inputs, and compare how runtime changes when n increases. Discuss why one result can be noisy: background processes, timer resolution, caching and small input sizes. Students produce one evidence-based claim using the structure: “When input changes from ___ to ___, ___ changes by approximately ___, suggesting ___.”
51–56 min · Formative discussion and misconceptions. Pairs compare claims, then respond to the slides’ prompts. Address likely misconceptions: Big O is not an exact time; dropping constants does not mean constants are irrelevant in practice; recursion is not automatically inefficient; memoisation removes repeated subproblems but uses memory; and a single benchmark cannot establish an asymptotic class. Students correct one misconception in their notes.
56–60 min · Exit ticket. Students complete the final section of the four-question exit ticket independently: classify (5n+4), explain constant-factor removal, state why naïve Fibonacci is inefficient, and identify what timing evidence would support an optimisation. Collect responses for next-lesson grouping.
functools.lru_cache, then compare its time and space trade-offs with the iterative solution and justify which implementation is most appropriate for a stated context.Join thousands of teachers using Kuraplan AI to create personalized lesson plans that align with Aligned with New Zealand Curriculum in minutes, not hours.
Created with Kuraplan AI
Generated using openai/gpt-5.6-luna
🌟 Trusted by 1000+ Schools
Join educators across New Zealand