Break up the algorithm into manageable pieces called "modules." For example, a pie recipe might be given in two parts: how to make the crust and how to make the filling. For more complex algorithms, the first block show s how other blocks fit together. These blocks are named in the first blocks and then the rest of the algorithm is a series of the blocks that were named in the first block. At any one time, you are only looking at one block, which makes the algorithm easier to understand.
An algorithm is a sequence of steps that describe how to do something. Algorithms are part of everyday life. When you tell someone how to do things like getting into the house, changing the font size in email or how to make chicken enchiladas, you create an algorithm. Algorithms are especially important in computer science when programmers tell computers how to do complicated steps for executing functions. Programmers have developed some techniques for simplifying and organizing complex algorithms.
Name any parts of the algorithm that repeat. When you find yourself doing the same series of steps, name the sequence and refer to this name when going through these steps. The "function" then becomes one of the modules of the algorithm.
Name conditional paths. For a short and simple algorithm, state the steps in the order they are performed. For complex algorithms, there is always a "conditional" branching of paths, where you introduce modularization and functions. The general form is "if X then Y, else Z," where X is a test of some sort and Y and Z are algorithm modules.
- Photo Credit Ablestock.com/AbleStock.com/Getty Images