These worksheets are free forever. Want lessons that adapt to your child as they learn, plus progress tracking? Try Ignition Learning free.

Sign up free

Ignition Learning — Activity Sheet

Algorithm design & debugging in practice

Technologies · Year 9

Name: ______________________Date: ____________

Designing an algorithm often means modifying or extending an existing one — fixing a bug, adding a new feature, or improving its efficiency — rather than always writing something entirely from scratch. Debugging is the systematic process of tracing through an algorithm's logic to identify exactly when its state (its variables and their values at a given point) becomes unexpected, understanding why this happened, and determining the precise change needed to correct it. Testing boundary cases — the edge conditions where an algorithm is most likely to behave unexpectedly (like an empty list, a zero value, or the very first/last item) — is essential to confirming an algorithm actually works correctly in every situation, not just the typical ones. For this activity, take an existing simple algorithm (write one out in plain steps, or use a real one you've studied), deliberately introduce a bug, then trace through and debug it — documenting exactly what went wrong and how you found and fixed it.

Example

An algorithm meant to find the largest number in a list might have a bug where it starts comparing from the second item instead of the first, silently skipping the first number entirely — this bug would only be caught by tracing through the algorithm's logic step by step, or by specifically testing the boundary case where the first item is actually the largest number in the list.

Key terms

Debugging:
The process of tracing through code to find and fix errors in its logic.
Boundary case:
An edge condition (like an empty list or the first/last item) where an algorithm is most likely to fail.

This topic is self-directed and doesn't have quiz questions.