Algorithms and
Pseudo Code
Session No.: 3
Course Name: Problem Solving and Computer Programming
Course Code: E1PA103B
Instructor Name: Manish Kumar
Duration: 50 minutes
Date of Conduction of Class: 11-09-2025
Galgotias University 1
Recap
Symbols used in flowchart
• A flowchart is a
visual algorithm:
a diagram that Terminal
shows the sequence
of steps in a
Decision
process using
standardized Input data
shapes (for
Flow
actions,
decisions, I/O)
and directed Process
arrows that
indicate the order
Galgotias University 2
of execution.
Opening Question
• Scenario:
Imagine you are designing software for an online
shopping system. The process includes:
• User login
• Browsing multiple categories
• Adding items to cart
• Applying discounts and coupons
• Selecting different payment methods (credit card, UPI, wallet,
EMI, etc.)
• Confirming order and tracking delivery
• Question for Students:
• Can you represent this entire process using a flowchart?
• What challenges will you face when the system grows larger
(e.g., adding refund policies, loyalty points, return/exchange
process)?
• If the flowchart becomes too complex, hard to read, and
difficult to update, howGalgotias
else University
could we represent the solution
3
in a simpler, structured, but more flexible way?
Learning Objective
At the end of this session students will be able
to
Understand the basics of
Algorithm and Pseudo code
Write algorithms and
represent them in pseudo
code for solving
computational problems.
Galgotias University 4
1. What is a
Algorthm?
2. What is Pseudo
Session Code?
Outline 3. Syntax and
Conventions
4. Activity 1
5. Summary
Galgotias University 5
What is Algorithm?
An algorithm is a finite sequence of computational
steps that transforms the input into desired output
in finite amount of time.
Galgotias University 6
Characteristics of
Algorithm
• Input: An algorithm has zero or more input
• Output: An algorithm has one or more output.
• Finiteness: An algorithm must terminate after a
finite number of steps.
• Definiteness: Each instruction must be clear and
unambiguous.
• Effectiveness: An algorithm must be effective in
such a way that its operations are sufficiently
basic and feasible.
Galgotias University 7
Example
Algorithm to check the given number is even or
odd?
1. Read number N
2. If N is divisible by 2 → print “Even”
3. Else print “Odd”
Galgotias University 8
Problem with Algorithm
• Lack of Standardization
• Algorithms are written in natural language, so they
may be ambiguous.
• Example: “Check each element in the list and find the
maximum.”
• Hard to Represent Loops & Conditions Clearly
• In algorithm form, loops and nested conditions become
wordy.
• Example: Repeat the process until all numbers are checked.
• Not Easily Translatable to Code
• Algorithms explain logic but don’t look like actual
code. Programmers still need extra effort to convert
them.
• Not Scalable for Large Systems
Galgotias University 9
Pseudo Code
• Pseudo codes reduces the problems with algorithms
• Pseudo code is a simplified, human-readable
representation of an algorithm. It looks like
programming code but does not follow strict syntax
rules. It acts as a bridge between the algorithm and
actual coding.
• Why use Pseudo Code?
• Easier to understand for both programmers and
non-programmers.
• Helps in planning logic before coding.
• Reduces errors during coding.
Galgotias University 10
Common Pseudo Code
Conventions
Input: N
Input/Output: READ, PRINT
If N mod 2 = 0
Assignment: SET, LET
then
Decision Making: IF … THEN Print
… ELSE
"Even"
Loops: FOR, WHILE, REPEAT Else
UNTIL
Print "Odd"
End Statements: END, STOP
End
Galgotias University 11
Learning
Activity 1
GSCALE full form and date 12
Learning Activity 1
Problem based Activity
• Problem: Write pseudo code to check whether a
number is prime or not.
• Step 1 (Think): Work individually for 3
minutes.
• Step 2 (Pair): Discuss your solution with a
partner (3 minutes).
• Step 3 (Share): Present ideas to class (4
minutes).
Galgotias University 13
Solution of Learning Activity
[Link] Input: n
If n <= 1 then
[Link] a number n
Print "Not Prime"
[Link] n ≤ 1, then
→ Print "Not Prime"
Else
→ Go to Step 8 set flag=0
[Link] a variable flag = 0 For i = 2 to n/2
[Link] each number i from 2 to If n mod i = 0 then
n/2, do: Set flag=1
[Link] n is divisible by i, Break
then if flag=1 then
→ Set flag = 1 Print "Prime“
→ Break the loop
else
[Link] flag = 1, then
→ Print "Not Prime"
Print “Not Prime”
[Link] End
→ Print "Prime"
[Link] Galgotias University 14
Summary
Flowcharts:→ Good for simple visualization,
not for complex logic.
Algorithms: → Logical steps of problem
solving.
Pseudo Code: → Structured, flexible, closer to
programming.
Galgotias University 15
Ensure attainment of LOs in
alignment to the learning
activities: outcomes (1-2)
Understand the basics of
Algorithm and Pseudo code
Write algorithms and
represent them in pseudo
code for solving
computational problems.
Galgotias University 16
Post session activities
•Write pseudo code to:
• Find factorial of a number
• Largest of three numbers.
• Print sum of digits of a given integer.
e.g. if number=1234, the output
=1+2+3+4=10
Galgotias University 17
Next lesson
• Next Lecture: Structure of C program and its
compilation
Galgotias University 18
Review and
Reflection from
students
Galgotias University 19