< Introduction to Algorithms

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

Objective

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

Completion status: this resource is a stub, which means that pretty much nothing has been done yet.

This article is issued from Wikiversity. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.