0% found this document useful (0 votes)
7 views

Algorithm-Pseudocode and Flowchart

The document provides an overview of algorithms, pseudocode, and flowcharts, emphasizing their roles in problem-solving and software engineering. It defines key characteristics of algorithms and illustrates how to represent them using pseudocode and flowcharts through examples. Additionally, it includes a class assignment for creating a pseudocode and flowchart to find the average of user-entered numbers.

Uploaded by

klopienclaudia
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)
7 views

Algorithm-Pseudocode and Flowchart

The document provides an overview of algorithms, pseudocode, and flowcharts, emphasizing their roles in problem-solving and software engineering. It defines key characteristics of algorithms and illustrates how to represent them using pseudocode and flowcharts through examples. Additionally, it includes a class assignment for creating a pseudocode and flowchart to find the average of user-entered numbers.

Uploaded by

klopienclaudia
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/ 22

Algorithm -

Pseudocode and
Flowchart

Assoc. Prof. Kazeem O. Oyebode


PhD Computer Engineering
Learning objectives

● Define pseudocode and explain its


purpose in representing computer
programs.
● Define flowcharts and describe their
purpose in visualizing program flow and
decision-making.
● Demonstrate the skill to translate
problem statements into flowcharts
and algorithms.
Algorithm

● An algorithm is a step-by-step process of solving a problem eiciently

● Algorithm is important in software engineering because it provides an


high level view of how a problem would be solved.
Characteristics of an Algorithm

● An algorithm must have input and output.


● An algorithm must be finite - it must have an end point.
● An algorithm should have sequence of steps.
● An algorithm should be reusable - it should be able to solve similar
problems .
Algorithm

● An algorithm can be visualized by means of


○ Flow chart
○ Pseudocode
Pseudocode

What is Pseudocode?
● Pseudocode is an English-like way of stating an
algorithm.
● Pseudocode is an informal and compact high-level
view of an algorithm
Pseudocode

What is Pseudocode?
● It does not have to follow the syntax of any particular
programming language.
● It however requires you to know how computers
operate. E.g. computers can prompt for input,
computers can store values, etc.
Pseudocode

● Example: Problem 1
○ Suppose we need to multiply and add any two
integer numbers supplied from a field experiment.
Write a pseudocode that shows your algorithm for
carrying out the task.
Pseudocode

● Problem 1 Solution:
○ prompt the user for number 1
○ save input to num1
○ prompt user for number 2
○ save input to num2
○ sum = num1 + num2
○ product = num1 * num2
○ print sum
○ print product
Pseudocode

● Example: Problem 2
○ Write a pseudocode solution that takes any integer value and
determines whether it is odd or even.
Pseudocode

● Problem 2 Solution:
○ prompt the user to enter the integer
○ save input in number
○ check if a reminder exists if you divide number by 2
○ if there is a reminder, print “the number is odd”
○ if otherwise, print “the number is even”
Flowchart

● A flowchart is a graphical representation of an algorithm

● Five figures are typically used to represent a flowchart


Flowchart
Flowchart

● Example: Problem 1:

○ We need to multiply and add any two integer numbers supplied


from a field experiment.

○ Write a flowchart that shows your algorithm for carrying out that
repetitive task.
Flowchart solution 1
Flowchart

● Example Problem 2

○ Write a pseudocode solution that takes any integer value and


determines whether it is odd or even.

○ Draw an equivalent flowchart.


Flowchart solution 1
Class assignment

● Create a pseudocode and flowchart for the problem statement below:

○ Find the average of numbers entered by user.


Summary
Summary

● We now know how pseudocode works

● Also flowchart is understood

● Finally, you know how to utilize pseudocode and flowchart in


problem solving.
FURTHER READING RESOURCES

● Python Programming Fundamentals (2nd Edition) by Kent


D. Lee
● Flowchart and Algorithm Basics: The Art of Programming
y A. B. Chaudhuri | Jun 23, 2020
● Python Programming: An Introduction to Computer
Science (2nd Edition) by John Zelle
Thank
You

You might also like