Goals
- Determine whether a problem is suitable for a computer solution
- Describe the computer problem-solving process and relate it to Polya's
How to Solve It list.
- Distinguish between following an algorithm and developing one
- Apply top-down design methodology to develop an algorithm to solve a
problem
- Define the key terms in object-oriented design.
- Apply object-orienteted design methodology to develop a collection of
interacting objects to solve a problem
- Discuss the following threads as they relate to problem solving
- information hiding
- abstraction
- naming things
- testing
Problem Solving
- What is problem solving?
- The act of finding a solution to a perplexing problem
- Intelligence is part of this process.
- And as we know, the computer is not intelligent.
- People are required to participate in computer based problem solving
- What is the computer good at doing?
- Accurate computation
- Very quickly
- For long periods of time
- A Programmer (some one who writes programs) must write a program (the
implementation of an algorithm in a programming language ) based on
an algorithm for a problem.
- Once this is done, you can solve the problem over and over again with
different inputs.
- A problem solving strategy
- Based on a book by George Polya
- Ask Questions - Understand the problem
- You must understand the problem
- You need to specify what the problem is to be able to do this
- This is an iterative process
- What do I know about the problem?
- What is the information I have to process in order to
find the solution?
- What does the solution look line?
- What are the special cases?
- How will I recognize that I have found the solution?
- I find
- Write down the questions, and the answers as you find them
- Ask the person that gave you the problem for information
- And ask others.
- In the beginning you should have fairly complete specifications for your problems, but this will change
- And some of us are not good at complete specification, so
you need to apply these methods anyway.
- If you don't understand the problem, how can you solve it?
- Look for Familiar Things
- Have you seen this before? If so, how did you solve it then?
- Have you done something close to this before, can you apply
that method here?
- Divide and Conquer
- Or break the problem down into little parts
- Don't solve the entire problem, just work on the smaller
pieces.
- Algorithms
- As we solve a problem, we produce an algorithm which later we
will turn into code.
- This is usually a repetitive process
- Computer Problem Solving
- Three phases
-
- Algorithm Development
- Analyze the problem
- Develop an Algorithm
- Test the algorithm
- Implementation
- Translate the algorithm into code in a programming language
- Run the program, check to see if the results are correct
- maintenance
- Use the program
- Fix problems that occur
- Add features
- correct newly detected errors
- Following Algorithms
- Developing Algorithms
- We will work on the the rest of the chapter
- And probably the rest of your life.
- Problem: You would like to build a house and have a
number of rectangular fields to consider as a building site.