L2a - Algorithms
L2a - Algorithms
1
Phases in problem solving
Problem
Solution
Time
2
Software life cycle
Requirements
Algorithm
Translate the algorithm into the chosen programming
Coding language. Includes program coding and fixing compilation
bugs.
Program
Maintenance Correct errors not detected in the testing phase. Make the
appropriate modifications if the requirements change.
3
Problem solving: Concept of Algorithm
Objective: Solve a
problem
Definition of Algorithm:
Accurate and unambiguous description of the
Analysis actions to be taken to solve a well-defined
problem in a finite time.
* It derives from the Latin translation of the word Alkhôwarîzmi, an Arab mathematician who
4
wrote an essay on the manipulation of numbers and equations in the 9th century
Algorithms and Programs
Objective: Solve a
Definition of Coding:
problem
Writing the algorithm using a programming
language.
We have to answer:
- What is the desired output? (type and quantity)
- What method produces the output?
- What input is needed? (type and quantity)
6
Analysis of the Problem: Example
We want to make a
program that reads,
via keyboard, the
person's birth year and
calculates the person's - What is the desired output? (type and quantity)
age. Then the program - Person’s age
must tell us if the
person is of legal age - Message informing if the person is of legal age
or not. - What method produces the output?
- Calculating age as the difference between the birth
year and the current year
- Comparison between age and age of majority (18
years)
- What input is needed? (type and quantity)
- Birth Year