Introduction to Algorithms/Subalgorithms

From Wikiversity
Jump to navigation Jump to search

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

Objective[edit | edit source]

Books-aj.svg aj ashton 01f.png

Subalgorithm[edit | edit source]

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[edit | edit source]

Crystal Clear app kedit.svg

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