Algorithm Development Process
An algorithm is a
plan for solving a problem. There are many ways to write an algorithm. Some are
very informal, some are quite and mathematical in nature, and some are quite
graphical. The form is not particularly important as long as it provides a good
way to describe and check the logic of the plan. The development of an
algorithm (a plan) is a key step in solving a problem. All programming
languages share basic code constructs; statements, loops, (do, for, while),
flow-control (if-else) etc. These common constructs can be used to write an
algorithm. There are many ways to write algorithms. You can have your own way
of writing algorithms but you must be consistent. The algorithm must take up a
well definite finite set of input and produce a well definite set of output.
The development of an algorithm (a plan) is a key step in solving a problem.
Once the algorithm ready, it can be translate it into a computer program in
some programming language. The algorithm development process consists of five
major steps.
Step 1: Obtain a
description of the problem.
Step 2: Analyse the
problem.
Step 3: Develop a
high-level algorithm.
Step 4: Refine the
algorithm by adding more detail.
Step 5: Review the
algorithm.
Step 1: Obtain a description
of the problem :
The problem should be
clearly explained, so that it’s easy for the developer to find the solution for
the problem. The problem description suffers from one or more of the following
types of flaws:
v The
description relies on unstated assumptions.
v The
description is ambiguous.
v The
description is incomplete.
v The
description has internal contradictions.
These flows
are seldom due to carelessness by the client. or sometimes by natural languages
(English, Korean, etc.)
Step 2: Analyse the problem :
The purpose of this
step is to determine both the starting ending points for solving the problem.
When determining the starting point, start with following questions:
v What data are
available?
v Where is that
data?
v What formulas
are related to the problem?
v What rules
are needed for the data?
v What
relationship exist among the data values?
When
determining the ending point, the characteristics of a solution are described.
The following questions help in determining the ending point.
v What new
facts will arrive?
v What items
will change?
v What things
will no longer exist?
Step 3: Develop a high-level algorithm :
An algorithm is a
plan for solving a problem. It’s usually better to start with a high-level
algorithm that includes the major part of solution, but sometimes more details
can be add the later. An example is given to demonstrate a high-level
algorithm.
Problem
Statement: I need to make a tea.
Analysis: I
don’t have milk.
High-level algorithm:
v Go to a
stores that sells milk.
v Purchase milk
and come home.
v Prepare tea.
Though
this algorithm seems to be satisfactory, it lacks many details such as the
following.
v Which store I
need to visit?
v Which milk
product I need to buy?
v How I go to
the store: walk, drive, ride my two-wheeler, take the bus.
These kinds of details are considered in the next step of our
process.
Step 4: Refine the algorithm by adding more detail :
A high-level
algorithm shows the major shows the major steps that need to be followed to
solve a problem. Our goal is to develop algorithms that lead to computer
programs. In this case, consider all capabilities of the computer and provide
enough details so that it’s easy to write algorithms.
In simple examples
moving from high-level to a detailed algorithm is done in a single step, but
this is not always reasonable. For larger, more complex problems, it is common
to go through several times. Each time, more details are added to the previous
algorithm. This technique of gradually working from a high-level to a detailed
algorithm is often called stepwise refinement.
Stepwise refinement
is a process for developing a detailed algorithm by gradually adding to a
high-level algorithm.
Step 5: Review the algorithm :
The final step is to
review the algorithm. Check the algorithm step by step to determine whether it
will solve the original or not.
v Does this
algorithm solve a very specific problem or does it solve a more general problem?
v If it solves
a very specific problem, should it be generalized?
0 Comments