Difference Between Similar Terms and Objects

What is the difference between Pseudocode and Algorithm?

What is the difference between Pseudocode and Algorithm

In very simple terms, Pseudocode is a narrative describing algorithm logic.

Pseudocode is not executable code so not mandatory to use an exact syntax; however, it is helpful to follow a widely-used standard in the industry, which can be easily understood by the solutions team.

Unified Modelling Language (UML) and other business modelling methodologies can also be termed examples of pseudocode.  Although not purely text-based, these tools are used to provide a visual representation of an executable task or process.

It is best practice to clearly document structured and complete pseudocode to help translate it accurately and it is an essential part in planning the solution and programming logic.

If the pseudocode doesn’t exist for an algorithm, then unnecessary time is spent thinking out the solution, or extracting some vague idea while in the coding stage, usually with a deadline looming.

When troubleshooting an algorithm, the pseudocode provides the background thinking in how it was put together and the developer may or may not always be around to help figure it out.

Look at this pseudocode example from Khan Academy[i]:

This is text-based pseudocode written in a software development tool.

The preceding strokes // indicate the text is a comment (or commented out in development terms) and is therefore not part of the executable code.

The bold text below shows the developer’s syntax and dimensions as they interpret it from the requirements in the pseudocode into executable code.

// How do we get our ideas into code?

// Draw the face, an oval in the center
ellipse(width/2, height/2, 200, 300);

// Draw the two eyes, two ovals, about 2/3 up the face, and 1/5 the size of the face
ellipse(width/240, height/250, 40, 40);
2 + 40, height/250, 40, 40);

Another example below shows a more technical and structured approached to writing pseudocode:

If student’s grade is greater than or equal to 60

Print “Well Done!”


Print “Sorry, you failed”

When referring to structured pseudocode, there are standard terms that represent the algorithm logic, such as SEQUENCE, WHILE, IF-THEN-ELSE and additional constructs that are also useful include REPEAT-UNTIL, CASE, and FOR.

These terms are understood by developers and helpful to build requirements without using slang or personal terms that may not be understood by others.

  • SEQUENCE indicates the top to bottom execution of tasks sequentially.
  • WHILE is a repetitive loop being executed until a condition, defined at the start is met.
  • IF-THEN-ELSE is a decision taken between two conditions:

IF HoursWorked > NormalWeek THEN

Display overtime timesheet message


Display normal timesheet message

  • REPEAT-UNTIL is a repetitive loop being executed until a condition, defined at the end, is met.



UNTIL condition

  • CASE provides for multiple decisions based on the value of an expression.
  • FOR is a repetitive counting loop

Note that for each task or process, use the END/ENDIF (where IF is used) at the end to indicate it is the termination point or output result.

When constructs are nested within each other, they must be clearly indented from their parent constructs, so in other words, all statements that show a dependency should be indented.

With verbs, the ‘doing’ words, make use of terms such as Process, Computer, Reset, Increment, Add, Multiply, Print, Display etc and note the indentation promotes desirable pseudocode.

What is the difference between Pseudocode and Algorithm-1

Now let’s look at algorithms and how they are different to pseudocode.

Firstly, what is an algorithm?

“Informally, an algorithm is any well-defined computational procedure that takes
some value, or set of values, as input and produces some value, or set of values, as
output. An algorithm is thus a sequence of computational steps that transform the
input into the output
.” [ii]

So in more simple terms, an algorithm is executable code logic defined by a sequence of steps to resolve a problem or complete a task.

Unlike pseudocode, the person writing the algorithm needs programming knowledge because it is interpreted by the computer – not a developer – to execute tasks, manipulate, encrypt, and extract data.

Algorithms fundamentally instructs a computer program to perform a task, as defined in the code logic.  Errors in any programming syntax will prevent successful execution of these tasks, which is where the programming knowledge is needed.

When writing pseudocode in the planning stage, remember the algorithm must be effective, focused and reach an end result; all aspects of the solution must always be considered.

What does the algorithm do?  Fundamentally, it is executed by a trigger, or process, or another algorithm and accepts data as its input.  The data goes through the steps of instructions and manipulations to produce the output.

The data is stored in variables and each variable is named for the algorithm to assign the data to it during the execution process.

Algorithms are also named because they can include references and calls to other algorithms.  There can be many complexities and technicalities when developing algorithms, regardless of the coding software being used and therefore needs to be well-defined to produce accurate and desired results.

Another important aspect to consider with the design and implementation of an algorithm is how fast it executes.  This is increasingly evident with end users who are getting accustomed to faster software and faster devices.

For example, applying filters to search criteria and waiting an unusually long time for the results to display can be an insufferable experience.  Developers would then investigate how and when the data is being received, can the data be filtered in a sub-process, etc.

Writing code logic that slows down any process has negative repercussions on the users, developer, and the business.

In summary, pseudocode is an important narrative for planning code logic and implementing robust solutions.  These solutions are implemented using well-structured, fast, and effective algorithms that produce accurate and desired results.



Search DifferenceBetween.net :

Custom Search

Help us improve. Rate this post! 1 Star2 Stars3 Stars4 Stars5 Stars

Email This Post Email This Post : If you like this article or our site. Please spread the word. Share it with your friends/family.

Leave a Response

Please note: comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

References :

[0][i] Khan Academy – Planning with pseudo-code: https://www.khanacademy.org/computing/computer-programming/programming/good-practices/p/planning-with-pseudo-code

[1][ii] Source: Thomas H. Cormen, Chales E. Leiserson (2009),Introduction to Algorithms 3rd edition.

[2][ii] Source: Thomas H. Cormen, Chales E. Leiserson (2009),Introduction to Algorithms 3rd edition.

Articles on DifferenceBetween.net are general information, and are not intended to substitute for professional advice. The information is "AS IS", "WITH ALL FAULTS". User assumes all risk of use, damage, or injury. You agree that we have no liability for any damages.

See more about : ,
Protected by Copyscape Plagiarism Finder