Algorithm Presentation: Flowchart
From the introduction to algorithm curriculum
TL;DR
Flowcharts are visual maps that show the steps of an algorithm using standard shapes and arrows. They help you understand and communicate how a process works by illustrating the sequence of operations and decisions. You use them to plan algorithms, debug issues, or explain complex logic clearly.
1. The Mental Model
Think of a flowchart as a treasure map for your algorithm. Each step is a location, and the arrows show you the path to follow to find the "treasure" (the solution). It's a way to draw out exactly what needs to happen, in what order, and what choices need to be made along the way.
2. The Core Material
A flowchart uses specific symbols to represent different types of actions or steps in an algorithm. These symbols are connected by arrows that show the direction of flow. Understanding these standard symbols is key to reading and creating effective flowcharts.
Common Flowchart Symbols:

Photo by ThisIsEngineering on Pexels
- Terminator (Oval/Rounded Rectangle): Represents the start or end of the algorithm.
- Process (Rectangle): Shows an action or an operation, like "Add 5 to X" or "Calculate total."
- Decision (Diamond): Represents a point where a question is asked, usually with a "Yes/No" or "True/False" answer, leading to different paths.
- Input/Output (Parallelogram): Indicates when data is entered into the algorithm (input) or when results are displayed (output).
- Flow Line (Arrow): Connects symbols and shows the direction of the algorithm's flow.
How Flowcharts Work

Photo by ThisIsEngineering on Pexels
You start at a "Start" symbol and follow the arrows. When you hit a process box, you perform that action. When you hit a decision diamond, you answer the question inside it and follow the arrow corresponding to your answer. This continues until you reach an "End" symbol.
Flowcharts are great for:
* Visualizing Logic: They make complex sequences easy to grasp.
* Planning: You can sketch out an algorithm before writing any code.
* Debugging: You can trace the flow step-by-step to find where things might go wrong.
* Communication: They're a universal way to explain how an algorithm works to others, even if they don't know the specific programming language.
graph TD
A["Start"] --> B["Get two numbers: Num1, Num2"]
B --> C{"Is Num1 > Num2?"}
C -- "Yes" --> D["Max = Num1"]
C -- "No" --> E["Max = Num2"]
D --> F["Display Max"]
E --> F
F --> G["End"]
3. Worked Example
Let's create a flowchart for an algorithm that calculates the sum of numbers from 1 up to a given positive integer N.
- Start: We begin.
- Input N: Get the positive integer
Nfrom the user. - Initialize: Set a
Sumvariable to 0 and aCountervariable to 1. - Decision (Loop Check): Is
Counterless than or equal toN?- Yes: Add
CountertoSum. IncrementCounterby 1. Go back to the Decision step. - No: Exit the loop.
- Yes: Add
- Output Sum: Display the final calculated
Sum. - End: The algorithm finishes.
If N is 3:
* Start
* Input N = 3
* Sum = 0, Counter = 1
* Is 1 <= 3? Yes. Sum = 0 + 1 = 1. Counter = 2.
* Is 2 <= 3? Yes. Sum = 1 + 2 = 3. Counter = 3.
* Is 3 <= 3? Yes. Sum = 3 + 3 = 6. Counter = 4.
* Is 4 <= 3? No.
* Output Sum (which is 6).
* End.
4. Key Takeaways
- Flowcharts use standard graphical symbols to visually represent an algorithm's steps and logic.
- Arrows show the sequence of operations, indicating the direction of flow.
- Ovals denote start/end, rectangles denote processes, parallelograms denote input/output, and diamonds denote decisions.
- They are excellent tools for planning, understanding, debugging, and communicating algorithms without code.
- Decisions in flowcharts always lead to multiple paths, typically "Yes" or "No" branches.
- Flowcharts help break down complex problems into smaller, manageable visual components.
- Every flowchart should have a clear start and end point.
Common Mistakes to Avoid

Photo by KATRIN BOLOVTSOVA on Pexels
- No Clear Start/End: Always include a terminator symbol for both the beginning and end of your flowchart.
- Ambiguous Arrows: Ensure arrows clearly indicate the flow; avoid crisscrossing lines unnecessarily.
- Incorrect Symbol Usage: Don't use a process box for a decision, or an input/output symbol for a calculation. Stick to the standard symbols.
- Overly Detailed Boxes: Keep the text in each symbol concise and to the point; avoid writing paragraphs.
- Missing Paths from Decisions: Every decision diamond must have arrows leading out for all possible outcomes (e.g., both "Yes" and "No").
- Logical Errors: The flowchart should accurately reflect the actual sequence of operations and decisions required by the algorithm.
5. Now Try It
Draw a flowchart for an algorithm that checks if a user-entered number is positive, negative, or zero.
What to do:
1. Start your flowchart.
2. Get a number from the user.
3. Use decision symbols to first check if the number is greater than zero.
4. If it's not, use another decision symbol to check if it's less than zero.
5. Display an appropriate message ("Positive," "Negative," or "Zero") based on the checks.
6. End your flowchart.
What success looks like: Your flowchart will clearly show the sequence of steps and decisions, using the correct symbols, to correctly classify any integer the user provides.
Frequently asked about Algorithm Presentation: Flowchart
More from introduction to algorithm
Get the full introduction to algorithm curriculum
Clone the complete plan to your dashboard for unlimited AI-generated notes, practice quizzes, and a personalised revision schedule.
Save this course free