An algorithm in someone's head is not much use; to be shared, checked, and built it must be written down in a form other people or a computer can follow.
There are three common representations: natural language, a flowchart, and code. All three can describe the same logic but aim at different readers and stages, from a rough sketch to a finished program.
How something is represented is also a question of accountability. A rule kept only as code on a company's servers stays invisible to the people it affects. Written in plain language, the same rule can be read and challenged by them (power, values and ethics).
Natural Language and Pseudocode
The simplest representation is plain natural language: steps written as ordinary sentences. Anyone can read it with no training, ideal for explaining to a non-expert or a first draft.
Its weakness is ambiguity. A phrase like keep going for a while has several readings. A person fills the gap with common sense; a computer cannot.
Pseudocode keeps the readability of plain language but adds the structure of code, with clear steps, conditions, and loops, while staying free of any one programming language's rules. It is the middle ground where logic is worked out before real code is written.
Flowcharts
A flowchart represents an algorithm as a diagram: boxes for steps joined by arrows showing order. Its strength is that the flow, especially branches and loops, can be taken in at a glance.
Standardised shapes make them readable: an oval marks start or end, a rectangle is a process step, and a diamond is a decision that splits the path in two.
The trade-off is space: flowcharts are excellent for small or branch-heavy algorithms, but a large one becomes a sprawling diagram harder to read than a few lines of pseudocode.
Code and Programming Languages
The most precise representation is code, written in a programming language such as Python or Java. Code is the only form a computer can run, and it is exact to the last character.
The cost of that precision is rigidity. Code has strict grammar, so a single missing symbol stops it working, and reading it fluently needs training a general audience lacks. It is tied to a particular language, though the algorithm underneath could be written in any.
A processor only understands low-level instructions, so code is translated again before running, either compiled ahead of time or interpreted line by line. Which language a team picks is usually a matter of convenience; the machine can run the same logic either way.
Hint
Hint
Natural language and pseudocode: for planning and for people.
Flowchart: for seeing the logic and its branches.
Code: for a machine to run, exactly as written.
Choosing the Right Representation
No single representation is best; the right choice depends on purpose and audience. Always ask who needs to read this and what they need to do with it.
Natural language is best for explaining an idea. A flowchart shows every branch clearly. Only code can hand the algorithm to a machine. Most projects move through several forms in turn, since each catches problems the others miss.
A navigation app shows all three: a designer describes the routing idea in words for the product team, draws decision points as a flowchart to check detours and closed roads, then writes the code that runs on millions of phones.
Tracing an Algorithm
You can check an algorithm by tracing it: following it step by step by hand, tracking every value as it changes. This is also called a desk check.
A trace uses a small table, one column per variable, adding a row each time a value updates. It reveals whether the result is right and, when it is not, exactly which step goes wrong.
Real systems have too many inputs to check by hand, so developers write automated tests across thousands of cases, though even that only samples the possibilities rather than proving correctness. Working a few cases still builds the intuition to trust or doubt a larger system.
Theory of Knowledge
TOK
If tracing shows an algorithm gives the right answer on the cases you tried, can you ever be sure it is correct for every case?
When an automated decision is wrong, how much should we expect its makers to have traced and tested it first?
Active recall
Self review
What are the three common ways to represent an algorithm?
How does pseudocode improve on plain natural language?
What do the standard flowchart shapes (oval, rectangle, diamond) mean?
What are the strengths and costs of code, and how do you choose a representation for a given audience?