Defining algorithms in depth
As we mentioned in Chapter 2, Elements of Computational Thinking, an algorithm is simply a set of instructions. We use instructions in everyday life, sometimes consciously, sometimes unconsciously. Think about the routines you follow in the morning, for example. The alarm clock sounds. What do you do next? Do you go prepare coffee? Shower? Brush your teeth first?
Most of us follow the same steps every single morning. You could say we’ve programmed ourselves to follow those steps. Now think of a time your schedule changed and your routine was different. I know I’ve had to stop and regroup many times because my program no longer works. I can’t wake up at 6 a.m. for a 5 a.m. flight, for example. But by changing my wake-up time, I may do things out of order and maybe even forget something because my program just didn’t work the same.
Algorithms for computers are similar in that we need to reprogram the set of instructions if...