PF Lecture 04
PF Lecture 04
Problem Solving
+
Implementation
Programming….
Verify
Dry run
Phases
…
Implementation Phase
Concrete Solution
Algorithm → Program
Test/Evaluate
Manual/Automated
Maintenance
Improvements
Programming!!
!
Problem Solving…. Clue for Learning
(CFL)
“An expert is a man who has made all the mistakes which can be made in a very narrow
field.”Niels Bohr
“Anyone who has never made a mistake has never tried anything new.” Albert Einstein
Problem Solving……Simplicity (CFLs:)
“Any intelligent fool can make things bigger and more complex... It takes a
touch of genius - and a lot of courage to move in the opposite direction.”
Albert Einstein
Take the problem and break it down in to smaller and smaller chunks that
are now manageable.
Formalizing the Thinking Process!!!!
In day to day life, we come to a lot of problems and find solutions to them…..
Finding a solution starts with thinking….
Write down a detailed list of instructions on how to open a bottle. [2 column form]
Write down a detailed list of instructions on how to make a cup of tea. [2 column
form]
Correct
always returns the desired output for all legal instances of the
problem.
Unambiguous
Precise
Efficient
Can be measured in terms of
Time
Space
Time tends to be more important
Representation of
Algorithms
English description
Flow Chart More
More easily Pseudo-code
expressed precise
High-level programming language
Problem Solving….
2- Algorithm
Algorithmic Constructs
Flow Chart
Pseudo code
3- Test/Evaluate
Dry run
Analyze the Problem…
Write a problem analysis chart (PAC) that asks a user to enter the distance of
a trip in miles, the miles per gallon estimate for the user’s car, and the
average cost of a gallon of gas. Calculate and display the number of gallons of
gas needed and the estimated cost of the trip.
Input Processing Output
distance, Step1: gas needed = Display gas needed
miles per gallon, distance / miles per
cost per gallon gallon.
Display estimated cost