Algorithm for writing an Algorithm
-
Know the primitives for the computing agent that will be used
to solve the problem.
-
Read the Problem carefully so that you understand what is being
asked.
-
Work out several concrete examples of the problem by hand using
mathematical and logical primitives.
-
By working out several examples of the problem by hand you will be able
to establish the sequence for carrying out the primitives.
This is the all important process of abstraction where we observe
the patterns involved in solving a problem and code the sequence as an
abstract algorithm.
-
If there are parts of the sequence that are repeated then
use a repeat loop
around the repeated parts.
-
If there are parts of the sequence that are conditionally
done, then set up an if - then - else
construct.
-
If a series of items have the same actions performed on them,
they can be represented symbolically as
subscripted variables
and the actions can be specified in a loop with an index variable
used to specify which variable is being acted upon.