Introduction to Algorithms/Subalgorithms

This is a lesson in in the course, Introduction to Algorithms, which is a part of The School of Computer Science

Objective
The objective is to teach you all the necessary stuff that is usually taught in a university level course.

Subalgorithm
Algorithms are often broken down into smaller chunks, called Subalgorithm. This is both so that they are easier to read, and also because then parts of the algorithm can be reused. What follows is the above algorithm in a more formal manner. The text in italics below are the names of the Subalgorithm that are being called.

Algorithm for making buttered toast (2.0) get a loaf of bread. cut slice from the loaf of bread. move the slice of bread to the toaster. turn on the toaster. wait for the toaster to finish. move the slice of toast to a plate. spread the slice of toast with butter. turn off the toaster.

Assignments


Subalgorithm for applying mascara

grab the mascara from the cabinet

unscrew the lid

dab any excess product on rim

use the mascara wand and apply to lashes in upward motion

repeat this step until you get the desired results

apply to bottom lashes

screw the lid back on

place mascara back in cabinet


 * Previous Lesson
 * Next Lesson
 * Course Home Page