DEV Community

Discussion on: Could you explain #likeimfive Psuedocode & its purpose?

Collapse
 
alajmo profile image
Samir Alajmovic • Edited

What:

Pseudocode visualizes the steps of an algorithm, often in a human language (English, Spanish, etc.). It is usually not executable (executable code is code which produces some sort of result upon execution).

Why:

It allows people to grasp concepts / ideas before implementation, since the implementation and result of an algorithm is a cost (time, energy, money, etc.) in itself.

Real life example:

You want to program a machine to move items between location A and B. Before programming executable code to perform said task, you are given pseudocode of two algorithms, algorithm 1 and algorithm 2. By inspecting the pseudocode, you realize that the cost of algorithm 1 is 10 seconds (execution time) and cost of algorithm 2 is 20 seconds (execution time), and so you choose to implement algorithm 1.

Collapse
 
frvzier profile image
Emanuel Frazier

Very well explained sir, thanks!