Search
Browse
Create
Log in
Sign up
Log in
Sign up
Upgrade to remove ads
Only $2.99/month
Problem Solving
STUDY
Flashcards
Learn
Write
Spell
Test
PLAY
Match
Gravity
Terms in this set (20)
Why do we need problem solving skills?
Programming Computers effectively is largely
dependent upon our ability to solve problems
Programs essentially set out to resolve some problem
Essentially we want to come up with a specific &
efficient set of steps that can be repeated to solve our
problem
● This set of steps is called an algorithm
● For example, if we want to find out the largest of 3 numbers
what is the process we employ to achieve this result
Once we come up with our algorithms then we convert
it to code so it can solve that problem repeatedly
● Programs are usually consist of many algorithms
Problem Solving Process
1 - Analyze the problem
2 - Solve & Define the algorithm
3 - Test the algorithm
4 - Refine the algorithm
Problem Solving Process Explained
1- Analyze the problem
● Try to gain a greater understanding of it
● Break the problem down into smaller parts
◘ AKA Divide and Conquer big problems can be
overwhelming!
● use one of the methods we'll discuss later
2 - Solve & Define the algorithm
● If can solve it once, then we can start to figure out
what steps we employed.
● Define these so we can solve it again.
Problem Solving Process Explained (2)
3 - Test the algorithm
● Verify that it works
● Follow your steps and make sure they solve the
problem
4 - Refine the steps
● Try to find a more efficient/effective way of solving
the problem
Analyzing and Initial Solution
Determine what the problem is
● Try to come up with one possible solution
This is where we will start in this class
We will use a variety of techniques to analyze
and solve problems:
● Build upon what you know
● Analyzing the problem state
● Thinking outside the box
● Look for similarities in previously solved problems
● Means-Ends Analysis
● Divide and Conquer
Build Upon What You Know?
Often in software development you will have a
seemingly disjoint set of requirements
One approach is to
Build upon your current knowledge
Analyze each fact and determine if you can
deduce anything based on those facts that will
lead towards a solution
● Try to solve in some systematic order
● Take one requirement at a time
Summary - Build upon what you know
The purpose of this drill is to start with one
clue
● systematically address each requirement
Most problems in CS consist of many
requirements
It is important to address each requirement
without violating another requirment
Analyzing and Solving Techniques
Build upon what you know
Analyzing the problem state
Thinking outside the box
Look for similarities in previously solved
problems
Means-Ends Analysis
Divide and Conquer
Analyzing the Problem State
Sometimes we can list each possible state.
● analyze each possibility individually.
The problem can be solved through the
process of elimination
● In other words --- which possibilities can be
eliminated and which ones can't
... or through a series of deductions
Analyzing the problem state (continued)
The 5 hats / 3 prisoners problem is an example of
analyzing the possible states
Using this method
● Identify that there is a limited number of choices
● List out the choices and analyze them
● Sometimes it is trial and error this is okay for limited
choices
For the 5 hats ____________________________
___________________________________________
We examined all the possible states for all three
prisoners (there were only 7)
From these we deduced ______________________
___________________________________________
otherwise the seeing prisoners would have spoken up
Let's expand upon this technique to solve the next
problem
Thinking Outside the Box
- Sometimes we put constraints on problems
- We need to look at the constraints and determine if the problem dictates those constraints or if we do
- If it is use then we need to think beyond our preconceptions
Look for Similarities in previously solved problems
Look for similarities in other problems you have
solved.
- For Example
Finding the heaviest & lightest weight
is really the same problem as
Finding the highest and lowest grades on a test
is really the same problem as
Finding the daily high and low temperatures
all 3 problems can be abstracted as being
Find largest and smallest values in a set of numbers
Means-Ends Analysis
Beginning state and End state are often given
● You need to define a set of actions that can be used
to get from one to the other
● Once you have a set of actions, you need to work out
the details
Translated to computer programming
Begin by writing down the inputs.
● (Beginning state)
What should the output be for those inputs?
● (End state)
What processing need to be performed to
obtain the desired results?
Divide and Conquer
- Break up large problems into smaller manageable problems
Divide and Conquer Example
Computer the area of a circle.
- Given the circe radius, the cirlce area should be displayed on the screen.
Input/Output description
- Input - Circe Radius
- Circle Area
Algorithm development (set of steps, decomposition outline)
1. Read value of circle radius (r)
2. Compute circle area as 𝛑* r
2
3. Print the value of circle area
How do we represent more complex algorithms
● Pseudocode, flowcharts
Divide and Conquer (2)
Pseudocode
BEGIN
PROMPT the user for the circle radius
READ radius
CALCULATE Circle area (𝛑* radius
2
)
OUTPUT Circle area
END
5 Basic Software Development Phases
1. Requirements Phase
Analyze and specify the problem
Define the problem inputs and outputs
2. Design Phase
Determine how the problem will be approached
and solved (Problem Solving)
Verify your solution solves the problem
specified
5 Basic Software Development Phases (2)
3. Implementation Phase
Code & document the program (Concrete solution)
Basic testing
4. Testing
More formalize testing make sure it meets the
specifications
5. Maintenance
Use the Program
Modify (meet changing requirements)
Fix bugs missed in implementation
Going from Problem Solving to Programming - Vocabulary
Algorithm
a step by step process for solving a problem.
Top-Down Design (design methodology)
break a larger problem into small parts progressing from the
general to the specific
The smaller parts are more manageable and easier to
understand
AKA "divide & conquer"
Hierarchical Input/Output "HIPO" Chart
A diagram of the top down design
Provides a hierarchical perspective of the systems
input, output, and processing modules
Module
One small part of the solution
Vocabulary (2)
Flowchart
A diagram of an algorithm using specific symbols that
represent programming constructs
Pseudocode
A terse, English-like description of an algorithm
Used to understand the basic program flow without worrying
about the correct syntax
Desk Check
Walking through the algorithm manually - step by step
Draw each memory location and check the algorithm as though
you were the computer
Documentation
Anything that provides information about a program
Comments in the code, data tables that describe the data used
in the code & external documents (flow charts, user's manual,
the design, &etc)
YOU MIGHT ALSO LIKE...
Ch. 12 Problem Solving
57 terms
Chapter 12 - Problem Solving
55 terms
CH 12
52 terms
Problem Solving (Chapter 12 HC)
15 terms
OTHER SETS BY THIS CREATOR
Networking
37 terms
Software
15 terms
Forgotten History Facts
7 terms
Excel
13 terms