Problem Solving
Problem Solving
1
Problem Solving
Algorithm Design
1. Flowcharts
2. pseudo-code
Flowchart example
<Algorithm name>
// input ? The comment lines “//”
// function?
// Output?
Begin
<data definition>
<actions>
End
Algorithm Tracing
◦ Draw flowchart
◦ Find all possible paths
◦ Check each path with appropriate input data
◦ Observed Outputs do not conform to the expected ones → error in the
algorithm.
Efficiency:
- an algorithm may work correctly but be inefficient – by taking more time and
using more resources than required to solve the problem.
- becomes more important for larger programs.