Grade 9 · Media & Informatics
Compare algorithms by the number of steps they take and explain why efficiency matters.
Two algorithms can both give the right answer yet take very different amounts of work. Efficiency is about how many steps an algorithm needs, especially as the amount of data grows. On a short list the difference hardly shows; on a list of millions, a slow method can take far too long while a fast one finishes in a flash.
Searching shows this clearly. A linear search checks items one by one, so on a list of a million it might make up to a million checks. A binary search on a sorted list halves the remaining items each step, so a million items takes only about twenty checks. The gap grows enormously as the list gets bigger — which is why it is often worth sorting a list first so you can then search it quickly many times.
Sorting methods differ in efficiency too: a simple sort that compares every pair does a great deal of work on large lists, while cleverer sorts do far fewer steps. When choosing or judging an algorithm, programmers ask not just 'does it work?' but 'how well does it scale?' — because on real data, the number of steps is what decides whether a program feels instant or hopelessly slow.
Have a go right here. Nothing is saved and you can retry as much as you like. Create a free account when you want to save your progress and get Archie, your tutor.
Create a free account to save your progress, track mastery and ask Archie, your tutor, for a hand.
Already with us? Open this lesson in learncoach.ch for mastery tracking and Archie, your tutor.