What is problem solving? explain with example.
- Get link
- X
- Other Apps
What
is problem solving, exactly?
If your 1997 Honda Civic has blue smoke coming from the tailpipe, is
idling roughly, and has lost fuel
efficiency, this is a problem that can be solved with automotive knowledge, diagnosis, replacement equipment, and common shop
tools.
Friend: “Hey, you
should trade that old Honda in for something
new. Problem solved.”
But your friend’s suggestion wouldn’t really be a solution
to the problem—it would be a way to avoid the problem.
Problem: A matter or situation regarded as
unwanted or harmful and need to be dealt with and overcome.
Problems Include:
Constraints
Unbreakable
rules
Way
to solve problems
Constraints: fix current problems
do not purchase new
Cost
of repairs, time duration to repairs, new tools should be purchased or not.
While Solving problem we have
constraints:
Programming language platform
Performance
Memory
For a Programmer problem solving
is writing an original program that performs a particular set of tasks and
meets all stated constraints.
The
Fox, the Goose, and the Corn
The first classic problem we will
discuss is a riddle about a farmer who needs to cross a river.
PROBLEM:
HOW TO CROSS THE RIVER?
A
farmer with a fox, a goose, and a sack of corn needs to cross a river. The
farmer has a rowboat, but there is room for only the farmer and one of his
three items. Unfortunately, both the fox and the goose are hungry. The fox
cannot be left alone with the goose, or the fox will eat the goose. Likewise,
the goose cannot be left alone with the sack of corn, or the goose will eat the
corn. How does the farmer get everything across the river?
Step1:
take goose to other end
Step2:
come back empty first end
Step3:
take fox to other end
Step4:
come back with goose to first end
Step5:
take corn to the other end
Step6:
come back empty to first end
Step7:
take goose to other end
Step8:
completed
The
key constraints here are:
1.
The farmer can take only one item at a time in the boat.
2.
The fox and goose cannot be left alone on the same shore.
3.
The goose and corn cannot be left alone on the same shore.
If you remove
the constraints the problem is easy
We
could make a specific list of the actions we think we can take:
1.
Operation: Carry the fox to the far side of the river.
2.
Operation: Carry the goose to the far side of the river.
3.
Operation: Carry the corn to the far side of the river.
Discovered
the “hidden” possible operation,
1. Operation: Row the boat from
one shore to the other.
2. Operation: If the boat is
empty, load an item from the shore.
3.
Operation: If the boat is not empty, unload the item to the shore.
Sliding Tile
Puzzles
The
sliding tile puzzle comes in different sizes, which, as we’ll see later, offers
a particular solving mechanism. The following description is for a 3×3 version
of the puzzle.
PROBLEM: THE
SLIDING EIGHT
A
3×3 grid is filled with eight tiles, numbered 1 through 8, and one empty space.
Initially, the grid is in a jumbled configuration. A tile can be slid into an
adjacent empty space, leaving the tile’s previous location empty. The goal is
to slide the tiles to place the grid in an ordered configuration, from tile 1
in the upper left.
6 8 6 8-> 456 456
5 4 7 5 4 7 7 8 78
4 7 2 4 6 7
4 5 6 4 5 4 5 6
8 6 1 8 5 2
8 7 8 1 6 8 1
3
5 3 1
3 1 2 3 2 7
3 2 7
4 5 6 8 4 5 3 8 4 2 3 8 1
2 3 123
8 1 3 6 2 6 5 1
5 4 4 8 68
3
2 7 2 1 7 1 7
6 7 6 5 7 547
1 2 3 123 123 123
6 8 568 456 456
5 4 7 47 7 8 78
Techniques: Always have a pen, Restate the Problem,
Divide the Problem, Start with what you know, Reduce the Problem, Look for
Analogies, Experimental Approach
- Get link
- X
- Other Apps
Popular posts from this blog
Structure Notes
History, Basic Structure, C Token, Data Type, operators, printf() and scanf()
The C Language is developed for creating system applications that directly interact with the hardware devices such as drivers, kernels, etc. C programming is considered as the base for other programming languages, that is why it is known as mother language. It can be defined by the following ways: Mother language System programming language Procedure-oriented programming language Structured programming language Mid-level programming language History of C Language: C programming language was developed in 1972 by Dennis Ritchie at bell laboratories of AT&T (American Telephone & Telegraph), located in U.S.A. Dennis Ritchie is known as the founder of C language . It was developed to overcome the problems of previous languages such as B, BCPL etc. Initially, C language was developed to be used in UNIX operating system . It inherits many features of previous languages such as B and BCPL General Structure...
Comments
Post a Comment