Algorithms Alive! - Definition
What is an algorithm?
This is
a question posed by many people who do
not study computer science. However, in
this increasingly computer literate
world, it would be more beneficial to
know some algorithms as they impact your
daily life through you using the
computer.
An
algorithm is, roughly, a description of
how a certain task is done. Using this
definition, it can be said that opening
the door is the name of an
algorithm as the completion of this
algorithm would enable you to open the
door! Indeed, from this viewpoint, it can
be said that human lives consists of
algorithms: Deciding what to eat, what to
wear, what to do, all these are familiar
examples of how algorithms exist in our
daily life.
Take this algorithm for example:
Algorithm
OpenDoor
Step 1: Raise your hand so that it rests
on the doorknob.
Step 2: Twist the knob left.
Step 3: If the door opens, stop. If not,
turn the knob right.
End
Of
course, an algorithm has certain
chracteristics that set it apart from
just any procedure for doing things.
Donald Knuth listed, in 1968, 4
chracteristics of an algorithm:
1) An
algorithm always terminates. This means
that an algorithm always stops, however
long it takes to stop. Returning to our
previous example of opening the door, you
can see that the first criteria of the
"open the door" being an
algorithm has been met because the
"open the door" algorithm will
stop after you have opened the door. By
this same definition, an algorithm that
tries to calculate the exact value of pi
is not an algorithm as it will never
stop.
2) In
an algorithm, every step is described
precisely and unambiguously. Thus, our
"OpenDoor" algorithm is an
algorithm as it describes what needs to
be done precisely and without ambiguity.
3)
Every step of the algorithm is simple
enough so that it can be done in a
reasonable amount of time. Our
"OpenDoor" algorithm also
conforms to this statement as each of the
steps can be accomplished within a
reasonable amount of time.
4)
Finally, an algorithm always produces an
output, although an input may not be
required.
|