How to Determine Algorithms

How to Determine Algorithms thumbnail
Algorithms tell how to do something, like a recipe for how to make cookies.

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.


    • 1

      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.

    • 2

      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.

    • 3

      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.

Tips & Warnings

  • A rule of thumb in modularization is that a module should be small enough to fit on a single page or single computer screen.

  • An interesting situation is where more than one of the alternative paths must be taken. For example, if trying to understand a sentence and run into a word that has two meanings, you must pursue two paths. If you have a team of people or computers working on a project, these points are a natural place to break up the work among team members.

  • When through designing an algorithm, you should work through it with every possible type of example -- making sure that every example is processed correctly -- and make a check of every module. When you are finished, an unchecked module should be eliminated.

Related Searches



  • Photo Credit Images

Related Ads

View Mobile Site