An algorithm to get a computer to draw a square on the screen might consist of these steps:
The steps in this algorithm are in the correct sequence. This algorithm would result in a perfect square:
If there was a mistake when designing the algorithm, and the steps in this sequence were placed like this:
This algorithm would create this shape, rather than a perfect square:
Because step 6 is in the wrong sequence (it should switch with step 7), this algorithm failed. However, fixing the algorithm - and the square - is easy, because there are only seven steps to look through for the error.
Complex algorithms may have hundreds, if not thousands, of steps. It is critical to make sure all steps in the algorithm are in the correct sequence before programming begins. Once programmed, trying to find an instruction in the wrong sequence can be extremely difficult.