Story Programming

What is an algorithm?

10 minutes
Individual or Group

Example: Baking a Cake

Consider the following recipe.


  • 2 cups sugar
  • 1 and ¾ cups all-purpose flour
  • ¾ cups coca
  • 1½ teaspoons baking powder
  • 1 teaspoon salt
  • 2 eggs
  • 1 cup milk
  • ½ cup vegetable oil
  • 2 teaspoons vanilla extract
  • 1 cup boiling water


  1. Heat oven to 350 degree Fahrenheit
  2. Grease and flour two 9-inch round baking pans
  3. Stir together sugar, flour, cocoa, baking powder, baking soda and salt in large bowl.
  4. Add eggs, milk, oil, and vanilla.
  5. Beat on medium speed of mixer 2 minutes.
  6. Stir in boiling water (batter will be thin).
  7. Pour batter into prepared pans.
  8. Bake 30–35 minutes or until wooden pick inserted in center comes out clean.
  9. Cool 10 minutes.
  10. Remove from pans to wire racks.
  11. Cool completely.

Is the above description an algorithm? Remember that an algorithm is a description of how to perform a computation. Some characteristics of an algorithm are as follows.

  • It can solve more than one specific problem (that is, one algorithm gives rise to many computations)
  • It can solve different instances of a particular problem class
  • It can be general, but must not be vague
  • It gives correct results
  • Most algorithms should terminate (but there are important exceptions)
  • An algorithm must be expressible in a language that can be understood by the computer to execute it

Can this recipe can be used to produce multiple outcomes?

This recipe always produces the same kind of cake. Does this fact disqualifies it as an algorithm?

Where else would you see algorithms in the kitchen or at home? What is needed for an activity to qualify as an algorithm? Do you always need two lists (ingredients and instructions)?