What is an algorithm?
An algorithm is a precise, step-by-step set of instructions
for solving a task. An algorithm does not solve a task; it gives you a series
of steps that, if executed correctly, will result in a solution to a task. You
use algorithms every day but you often do not explicitly think about the
individual steps of the algorithm. For example, starting your car, putting on your
clothes, logging into your computer, or following a recipe for cooking a food
dish, are all accomplished using an algorithm, a step-by-step series of actions.
For an algorithm to be valid, each step (or instruction)
must be:
·
unambiguous – the instruction can only be
interpreted in one unique way
·
executable – the person or device executing the
instruction must know how to accomplish the instruction without any extra
information.
·
ordered – the steps of an algorithm must be
ordered in a proper sequence to correctly accomplish the task.
Introduction to Flowcharts and Algorithms
Introduction to
flowcharts
A flowchart is a graphical representation of an algorithm.
These flowcharts play a vital role in the programming of a problem and are
quite helpful in understanding the logic of complicated and lengthy problems.
Once the flowchart is drawn, it becomes easy to write the program in any high
level language. Often we see how flowcharts are helpful in explaining the
program to others. Hence, it is correct to say that a flowchart is a must for the
better documentation of a complex program.
Flowcharts are usually drawn using some standard
symbols:
- If the flowchart becomes complex, it is better to use connector symbols to reduce the number of flow lines. Avoid the intersection of flow lines if you want to make it more effective and better way of communication.
- Ensure that the flowchart has a logical start and finish.
- It is useful to test the validity of the flowchart by passing through it with a simple test data.
Only one flow line is used in conjunction with terminal
symbol
- Only one flow line should enter a decision symbol, but two or three flow lines, one for each possible answer, should leave the decision symbol.
- In drawing a proper flowchart, all necessary requirements should be listed out in logical order.
- The flowchart should be clear, neat and easy to follow. There should not be any room for ambiguity in understanding the flowchart.
- The usual direction of the flow of a procedure or system is from left to right or top to bottom.
- Only one flow line should come out from a process symbol.
No comments:
Post a Comment