Writing the Algorithm in Pseudocode

An algorithm is a step-by-step set of operations that need to be performed. If you take an algorithm and write code to perform those operations, you end up with a computer program.

If you’re new to programming and not entirely comfortable with a programming language’s syntax yet, you should consider writing out the algorithm using pseudocode, an English-like syntax that lets you think about the logic without having to worry about paper. Pseudocode isn’t just for beginners; experienced programmers will occasionally write some pseudocode on a whiteboard when working with teammates to solve problems, or even by themselves.

There’s no “right way” to write pseudocode, although there are some widely used terms. You ...

Get Exercises for Programmers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.