8.1. Algorithms Introduction

Simply put, an algorithm is simply a set of step-by-step instructions for accomplishing some task. If you have ever followed a recipe like the one below, you have followed an algorithm.

Chocolate Cream Pie 1. Heat milk, marshmallows, and chocolate in a 3-quart saucepan over low heat, stirring constantly, until chocolate and marshmallows are melted and blended. 2. Refrigerate for about 20 minutes, stirring occasionally until the mixture mounds slightly when dropped from a spoon. 3. Beat whipping cream in a chilled small bowl with an electric mixer on high speed until soft peaks form. 4. Fold the chocolate mixture into whipped cream. 5. Pour into a pie shell. 6. Refrigerate uncovered for about 8 hours or until set.

As long as you understand the directions, you do not need to know much about cooking to follow the recipe - this is the power of algorithms. Once we have created an algorithm, we no longer need to think about the principles on which the algorithm is based. All you have to do is follow the directions. This means that algorithms are a way of capturing intelligence and sharing it with others. Once you have encoded the necessary intelligence to solve a problem in an algorithm, many people can use your algorithm without needing to become experts in a particular field.

Algorithms are especially important to computers because computers are general-purpose machines for solving problems. But for a computer to be useful, we must give it a problem to solve and a technique for solving the problem. Through the use of algorithms, we can make computers “intelligent” by programming them with various algorithms to solve problems. Because of their speed and accuracy, computers are well-suited for solving tedious problems such as searching for a name in a large telephone directory or adding a long column of numbers.

Algorithm Requirements

To be useful, an algorithm must meet certain requirements:

Materials on this page adapted with permission from from:
Online Interactive Modules for Teaching Computer Science by Osman Balci et al.
You have attempted of activities on this page