3. Flowcharts.
So, what exactly is a flowchart? Well, think of it as a visual
roadmap for your algorithm.
3.1.
Definition of a Flowchart
A flowchart is a diagram that uses symbols and shapes to represent
the steps of an algorithm or process. It provides a graphical representation,
making it easier to understand the flow of logic and the sequence of
operations.
3.2.
Flowchart Notations
To create flowcharts, we use specific symbols that represent
different types of actions. Here are some basic symbols:
i.
Start/End: Represents the beginning or end of the
algorithm. Typically shown as an oval shape.
ii.
Process: Represents a step or action in the algorithm.
Typically shown as a rectangle.
iii.
Decision: Represents a point where a decision needs to be
made. Typically shown as a diamond shape. This is where you have a
"yes" or "no" question that determines the next step.
iv.
Input/Output: Represents data entering or leaving the
algorithm. Typically shown as a parallelogram.
v.
Connector: Used to connect different parts of the flowchart,
especially when it spans multiple pages or becomes too complex to draw on a
single page. Typically shown as a circle.
vi.
Arrow lines: Show the direction of the flow of the
algorithm. They connect the symbols to indicate the sequence of steps.
3.3.
Examples of Flowcharts
Now, let’s take those algorithms we talked about earlier and
represent them as flowcharts.
3.4.
Advantages and Limitations of Flowcharts
Like algorithms themselves, flowcharts have advantages and
limitations:
Advantages:
Easy to understand and visualize the
flow of the algorithm:. Flowcharts provide a clear, visual representation, making it
easier to grasp the overall logic.
Helpful for communicating the algorithm to
others: They serve
as a common language for discussing and explaining processes, even to those who
aren’t familiar with programming.
Limitations:
Can become complex and difficult to
manage for large algorithms. For very intricate processes, flowcharts can become cluttered
and hard to follow.
Not easily translated into code: While flowcharts help visualize the
logic, they aren’t directly convertible into programming code.
3.5.
Comparison with Algorithms
So, how do flowcharts compare to the algorithms themselves?
Algorithms are textual, while
flowcharts are graphical: Algorithms are expressed in text (like pseudocode or code), while
flowcharts use diagrams.
Algorithms are more precise, while
flowcharts are more intuitive:. Algorithms can be written with specific syntax and detail,
whereas flowcharts focus on the overall flow and may omit some of the finer
points.
Flowcharts can be helpful in the early stages of designing an
algorithm, but they’re often used in conjunction with more formal methods like
pseudocode or actual code. There is some evidence that subjects familiar with the
use of directed graphs may be better at identifying the general area of failure
and that flowcharts may clarify the description of conditional statements,
without necessarily improving understanding of the underlying logic.