0% found this document useful (0 votes)
9 views4 pages

4. Algorithms and Flowcharts_9626_AS Level Notes

Pseudocode is a step-by-step description of an algorithm using simple English, designed for human understanding rather than machine execution. It serves as an intermediary between an algorithm and its implementation in a programming language, aiding in planning and comprehension. Key rules for writing pseudocode include using capital letters for keywords, maintaining clear structure and readability, and ensuring it is easy to understand for non-programmers.

Uploaded by

mahima limaye
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views4 pages

4. Algorithms and Flowcharts_9626_AS Level Notes

Pseudocode is a step-by-step description of an algorithm using simple English, designed for human understanding rather than machine execution. It serves as an intermediary between an algorithm and its implementation in a programming language, aiding in planning and comprehension. Key rules for writing pseudocode include using capital letters for keywords, maintaining clear structure and readability, and ensuring it is easy to understand for non-programmers.

Uploaded by

mahima limaye
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

AS Level – IT (9626) 4.

Algorithm and Flowcharts 1|Page

What is PseudoCode: A Complete Tutorial


A Pseudocode is defined as a step-by-step description of an algorithm. Pseudocode does not use any
programming language in its representation instead it uses the simple English language text as it is
intended for human understanding rather than machine reading.
Pseudocode is the intermediate state between an idea and its implementation(code) in a high-level
language.
What is the need for Pseudocode
Pseudocode is an important part of designing an algorithm, it helps the programmer in planning the
solution to the problem as well as the reader in understanding the approach to the problem.
Pseudocode is an intermediate state between algorithm and program that plays supports the
transition of the algorithm into the program.

Pseudocode is an intermediate state between algorithm and program


How to write Pseudocode?
Before writing the pseudocode of any algorithm the following points must be kept in mind.
• Organize the sequence of tasks and write the pseudocode accordingly.
• At first, establishes the main goal or the aim.
Example:
This program will print first N numbers of Fibonacci series.
• Use standard programming structures such as if-else, for, while, and cases the way we use them in
programming. Indent the statements if-else, for, while loops as they are indented in a program, it
helps to comprehend the decision control and execution mechanism. It also improves readability to a
great extent.
Example:
IF “1”
print response
“I AM CASE 1”
IF “2”
print response
“I AM CASE 2”
• Use appropriate naming conventions. The human tendency follows the approach of following what
we see. If a programmer goes through a pseudo code, his approach will be the same as per that, so
the naming must be simple and distinct.
• Reserved commands or keywords must be represented in capital letters.
AS Level – IT (9626) 4. Algorithm and Flowcharts 2|Page
Example: if you are writing IF…ELSE statements then make sure IF and ELSE be in capital letters.
• Check whether all the sections of a pseudo code are complete, finite, and clear to understand and
comprehend. Also, explain everything that is going to happen in the actual code.
• Don’t write the pseudocode in a programming language. It is necessary that the pseudocode is simple
and easy to understand even for a layman or client, minimizing the use of technical terms.
Good vs Bad ways of writing Pseudocode:

Good Vs Bad way of writing Pseudocode


Difference between Algorithm and Pseudocode

Algorithm Pseudocode

A Pseudocode is a step-by-step description


An Algorithm is used to provide a solution to a
particular problem in form of a well-defined of an algorithm in code-like structure using plain
step- based form. English text.

Pseudocode also uses reserved keywords like if-else, for,


An algorithm only uses simple English words
while, etc.

These are fake codes as the word pseudo means


These are a sequence of steps of a solution to a
fake, using code like structure and plain English
problem
text

There are no rules to writing algorithms There are certain rules for writing pseudocode
AS Level – IT (9626) 4. Algorithm and Flowcharts 3|Page
Algorithm Pseudocode

Algorithms can be considered pseudocode Pseudocode cannot be considered an algorithm

It is difficult to understand and interpret It is easy to understand and interpret

Difference between Flowchart and Pseudocode


Flowchart Pseudocode

A Pseudocode is a step-by-step description


A Flowchart is pictorial representation of flow of an of an algorithm in code like structure using
algorithm.
plain English text.

A Flowchart uses standard symbols for input,


output decisions and start stop statements. Pseudocode uses reserved keywords like
Only uses different shapes like box, circle if-else, for, while, etc.
and arrow.

This is a way of visually representing data,


these are nothing but the graphical These are fake codes as the word pseudo means

representation of the algorithm for a better fake, using code like structure but plain English
understanding of the text instead of programming language
code

Pseudocode is better suited for the purpose of


Flowcharts are good for documentation
understanding

1) What are the 5 Rules of pseudocode?


Five important rules for writing pseudocode are:
1. Write one statement per line.
2. Initial keywords should be represented in capital case(READ, WRITE, IF, WHILE, UNTIL).
3. Indentation of pseudocode should be similar to the actual program to show hierarchy.
4. Ending the multiline structure is necessary.
5. Keep statements in simple language(English).

2) How do I start pseudocode?


At first, the purpose of the process should be written to make the aim clear.
AS Level – IT (9626) 4. Algorithm and Flowcharts 4|Page
3) Is pseudocode easy to learn?
Pseudocode uses plain text mostly written in English language which makes it easy to
understand and present.
4) Why do we use pseudocode?
Pseudocode provides easier understanding to people as compared to the conventional
programming language code that it is an efficient and platform-independent description of
the important principles of an algorithm.
5) Is pseudocode an algorithm?
Pseudocode is used to represent an algorithm but the structure of a pseudocode may not
follow the same flow as an algorithm is a well-defined sequence of steps that provides a
solution for a given problem.
6) What is the difference between pseudocode and flowchart?
A flowchart is a diagrammatic representation that illustrates a solution model and solution
flow to a given problem whereas Pseudocode is an informal high-level description of the
operating principle of an algorithm.
7) What is the difference between pseudocode and code?
Pseudocode is just a way to represent the algorithm of the program, it is how the code
would look like when if it is actually programmed. Source code is the actual code that can
be compiled by the compiler and then be executed by the machine.
8) Which is easier to use algorithm or pseudocode?
Pseudocode is written in English language thus it is easy to understand, construct and
simpler to debug on the other hand algorithm is quite complex to construct as it sometimes
involves code snippets in it and hence it is a bit difficult when it comes to debugging
algorithm.
9) How do you declare a variable in pseudocode?
In pseudocode Assigning a value to a variable is indicated using an arrow symbol (←). The
arrow points from the value being assigned towards the variable it is being assigned to.
Example: String ← “GeeksforGeeks”, would be a valid assignment.

10) What is end if in pseudocode?

To terminate a multiple line if command the endif command is used. The command can
either be specified as two separate words, ‘end if’ or as a single word, ‘endif’.

Pseudocode
Most programs are developed using programming languages. These languages have
specific syntax that must be used so that the program will run properly. Pseudocode is not a
programming language, it is a simple way of describing a set of instructions that does not
have to use specific syntax.
Common pseudocode notation
There is no strict set of standard notations for pseudocode, but some of the most widely
recognised are:

• INPUT – indicates a user will be inputting something


• OUTPUT – indicates that an output will appear on the screen
• WHILE – a loop (iteration that has a condition at the beginning)
• FOR – a counting loop (iteration)
• REPEAT – UNTIL – a loop (iteration) that has a condition at the end
• IF – THEN – ELSE – a decision (selection) in which a choice is made
• any instructions that occur inside a selection or iteration are usually indented

You might also like