The World of Algorithms
What is an algorithm?
Find out what an algorithm is, using the way you already add numbers.
To add 5 and 7 we once drew 12 dots and counted them. "Imagine doing 473 + 695 that way!"
An algorithm is a precise, step-by-step procedure, like a recipe for making tea: boil water, add tea leaves, add milk and sugar, strain. Leave out a step, or do them in the wrong order, and you don't get tea. A computer is the same: it does exactly what the steps say, nothing more.
The column method for addition is an algorithm:
- write the numbers with their rightmost digits lined up;
- add each column, from right to left;
- whenever a column reaches 10 or more, write the units digit and carry 1 to the next column;
- at the end, write any last carry.
Every step matters. Without the last step, 473 + 695 would give 168 instead of 1168. Adding from the left does not work either: a carry would arrive after you had already written that column.
The carry is never more than 1, because a column adds at most 9 + 9 + 1 = 19.
Precision matters too. The book's written steps say 'less than 10' and 'more than 10', so a column that adds to exactly 10 is not covered. An algorithm must say what to do in every case.
Why it works: each number is units, tens, hundreds, …; we add like with like, and 10 of one kind make 1 of the next. Why it is fast: going from 3-digit to 4-digit numbers means 10 times as many dots to count, but only one more column to add.
Practise this lesson
Questions that get harder as you improve, a Tutor that helps without giving the answer away, and progress you can see. Free for every learner.
No account, no email address. Opens the real product.