Algorithms
What is an algorithm?
An algorithm is a set of instructions on how to accomplish a
task
In Programming, two types of algorithm are used:
● Pseudo-Code
● Flow Charts
Pseudo-code
● Uses mixture of programming constructs & natural language
● Sometimes referred to as “Structured English”
● Does not use any specific programming syntax
Pseudocode Structure
● Includes Terminators (START program/END program)
● Uses Keywords, e.g. IF, THEN, ELSE, WHILE, UNTIL..(capitalized)
● Includes Control Structures
● Includes indentation for nested loops or conditionals
● Statements are concise
● All necessary information is included e.g. specific values
● Can include comments
Pseudocode Example
Flowcharts
● Give a visual representation of program
● Enables complex ideas to be grasped quicker
● Uses standardized symbols
Flowchart structure
FLOWCHART EXAMPLE
Flowchart or pseudocode?
Use Flowcharts when:
1. Visual Representation: You need a clear, visual depiction of a process or algorithm.
2. Communication: You want to communicate ideas to stakeholders who may not be familiar with programming.
3. Complex Processes: The process involves multiple decisions and steps that can benefit from visual organization.
Use Pseudocode when:
4. Detailed Logic: You need to express algorithms in a more detailed, structured way without focusing on syntax.
5. Algorithm Design: When designing algorithms for coding, as it helps clarify logic before implementation.
6. Cross-Platform: When you want to describe logic that can be applied in any programming language.