Download presentation
Presentation is loading. Please wait.
Published byAlisha Patrick Modified over 9 years ago
1
Jeroo Chapter 3 Problem Solving and Algorithms
2
Problem Solving and Algorithms The story of Aunt Kay A computer is a tool used to solve problems A computer program is a set of instructions. An algorithm is a plan for solving a problem. A person must design an algorithm. A person must translate an algorithm into a computer program.
3
An Algorithm Development Process The development of the algorithm is the key step. Step 1: Obtain a description of the problem Step 2: Analyze the problem Step 3: Develop a high-level algorithm Step 4: Refine algorithm by adding detail Step 5: Review the algorithm
4
Obtain a Description of the Problem The “client” is responsible for creating a description of the problem for the “developer” Common Problem Description Defects: The description relies on unstated assumptions The description is ambiguous The description is incomplete The description has internal contradictions Part of developer’s responsibility is to identify defects in the description and work to fix them
5
Analyze the problem Determine starting and ending points for solving the problem. Starting Point: What data are available? Where is the data? What formulas pertain to the problem? What rules exist for working with the data? What relationships exist among the data values?
6
Analyze the problem When determining ending point, describe the characteristics of a solution. How will we know when we are done? What new facts will we have? What items will have changed? What changes will have been made to those items? What things will no longer exist?
7
Develop a high level algorithm Add detail later…. Problem: I need to send a birthday card to my brother, Mark. Analysis: I don’t have a card. I prefer to buy a card rather than make one. High Level Algorithm: Go to store that sells greeting cards Select a card Purchase a card Mail the card
8
Develop a high level algorithm How much detail do we add? Who is going to implement the algorithm and how much they already know. If the goal is to develop an algorithm that leads to a computer program, consider: Capabilities of the computer Provide enough detail so someone else can write a program Better to have more detail if you are in doubt.
9
Review the algorithm Will it solve original problem? Once satisfied: Specific or general problem? Ex. Algorithm that computes the area of a circle with a radius of 5.2 meters = specific Algorithm that computes the area of any circle = general Can the algorithm be simplified? Is solution similar to the solution of another problem?
10
5 Step Algorithm Creation Process Step 1: Obtain a description of the problem Step 2: Analyze the problem Step 3: Develop a high-level algorithm Step 4: Refine algorithm by adding detail Step 5: Review the algorithm
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.