Algorithm and Flowchart
Algorithm
An algorithm is a detailed, unambiguous, and ordered procedure for accomplishing a task. In
computing, it's the logical foundation for writing a program. The same algorithm can be
implemented using different programming languages.
Writing a logical step-by-step method to solve the problem is called the algorithm. In other
words, an algorithm is a procedure for solving problems. In order to solve a mathematical or
computer problem, this is the first step in the process.
An algorithm includes calculations, reasoning, and data processing. Algorithms can be
presented by natural languages, pseudocode, and flowcharts, etc.
Key characteristics of an algorithm
Clear and unambiguous: Each step must be precisely defined and its purpose should be
clear.
Finite: It must terminate after a limited number of steps.
Input and output: It should accept a clearly defined set of inputs and produce a defined
output.
Feasible: It must be achievable with the available resources.
Example of an algorithm (in pseudocode)
Problem: To find the larger of two numbers.
1. START
2. Read the first number, A.
3. Read the second number, B.
4. If A is greater than B, display "A is the largest."
5. Else, display "B is the largest."
6. END
Flowchart
A flowchart is a graphical representation of an algorithm or process that uses standard symbols
to illustrate the sequence of steps and decisions. It helps programmers and others visualize the
logic of a program before writing the code.
Common flowchart symbols
Terminal (Oval): Represents the start and end points of a process.
Process (Rectangle): Shows an action, process, or a set of operations.
Input/Output (Parallelogram): Indicates when data is being input or output.
Decision (Diamond): Represents a point where a decision is made, typically a yes/no or
true/false question.
Flow lines (Arrows): Connect the symbols to show the sequence and direction of the
process flow.
Common Abbreviations Used in P&ID
Terminal Box - Start / End
Input / Output
Process / Instruction
Decision
Connector / Arrow
The symbols above represent different parts of a flowchart. The
process in a flowchart can be expressed through boxes and arrows
with different sizes and colors. In a flowchart, we can easily highlight
certain elements and the relationships between each part.
Difference between Algorithm and Flow chart
Algorithm
It is a procedure for solving problems.
The process is shown in step-by-step instruction.
It is complex and difficult to understand.
It is convenient to debug errors.
The solution is showcased in natural language.
It is somewhat easier to solve complex problem.
It costs more time to create an algorithm.
Flowchart
It is a graphic representation of a process.
The process is shown in block-by-block information diagram.
It is intuitive and easy to understand.
It is hard to debug errors.
The solution is showcased in pictorial format.
It is hard to solve complex problem.
It costs less time to create a flowchart.