Professional Documents
Culture Documents
MT114 – 2020/2021
Idrissa S. A.
Amour.Idrissa@udsm.ac.tz
Introduction to Computer
Programming – 1/2
Department of Mathematics - UDSM
November 4, 2021
Algorithms and Design
Short Discussion
Ask your friend how to prepare a tea!
Algorithms
An algorithm is an outline of unambiguous steps to be
followed to solve a particular task.
How it Works
Al-Khwarizmi: worked on steps to achieve goal.
Algorithms solves general problems, not specific.
Step-by-step methods a machine performs.
Before computers! Human vs Algorithm vs
Computers.
ISA MT114 – 2020/2021 2 / 10
Algorithms and Design
Exercise 1
Determine the weekday that Tanganyika became
independent.
ISA MT114 – 2020/2021 5 / 10
Algorithms and Design
Algorithms Design
3 ways to represent an algorithm:
1 Steps: Just like the weekday algorithm
2 Flowcharts: Algorithm is presented pictorially
3 Pseudocode: Code like steps for solving the
problem
Flowcharts
A flowchart: pictorial representation of algorithm or
workflow or process.
Shapes connected with arrows to show processes
and directions.
Analyzing/designing/documenting/managing
process.
The first ”flow process chart”, introduced in 1921.
Many categories: Here we focus on program
flowcharts.
Exercise 3
Design a complete algorithm that will be used to
determine if a given number is even or odd. Represents
using a flowchart.
Exercise 4
Design a flowchart algorithm that will be used to
determine the sum of integers between 1 and 1000.
ISA MT114 – 2020/2021 10 / 10