COS102 Lecture Note 2
COS102 Lecture Note 2
People face problems every day—usually, multiple problems throughout the day. Sometimes
these problems are straightforward, sometimes, however, the problems we encounter are more
complex. For example, say you have a work deadline, and you must mail a printed copy of a
report to your supervisor by the end of the business day. The report is time-sensitive and must
be sent overnight. You finished the report last night, but your printer will not work today. What
should you do? First, you need to identify the problem and then apply a strategy for solving the
problem.
Therefore, a problem is a gap between where you are and where you would like to be.” There
are different perspectives on the definition and nature of problems, as well as different types
of problems. Practicing different problem-solving strategies can help professionals develop
efficient solutions to challenges they encounter at work and in their everyday lives. Each
industry, business and career has its own unique challenges, which means employees may
implement different strategies to solve them. If you are interested in learning how to solve
problems more effectively, then understanding how to implement several common problem-
solving strategies may benefit you.
Problem solving is defined as “knowing what to do when you don’t know what to do”.
When people are presented with a problem—whether it is a complex mathematical problem or a
broken printer, how do you solve it? Before finding a solution to the problem, the problem must
first be clearly identified. After that, one of many problem solving strategies can be applied,
hopefully resulting in a solution.
Problems themselves can be classified into two different categories known as ill-defined and
well-defined problems. Ill-defined problems represent issues that do not have clear goals,
solution paths, or expected solutions whereas well-defined problems have specific goals,
clearly defined solutions, and clear expected solutions. Problem solving often incorporates
logical reasoning and interpretation of meanings behind the problem, and also in many cases
require abstract thinking and creativity in order to find novel solutions. Various methods of
studying problem solving exist including introspection, simulation, computer modelling, and
experimentation.
Understanding how a variety of problem-solving strategies work is important because different
problems typically require you to approach them in different ways to find the best solution. By
mastering several problem-solving strategies, you can more effectively select the right plan of
action when faced with challenges in the future. This can help you solve problems faster and
develop stronger critical thinking skills.
Step 7: Assess and evaluate whether the problem has been solved
It’s always important to assess after implementing your solution whether the problem was
solved and if not, what the reasons were.
If the plan did not work:
• Determine what and why it did not work.
• What can you do different to let it work
Problem-solving Strategies
1.1 Trial and Error
A trial-and-error approach to problem-solving involves trying a number of different
solutions and ruling out those that do not work. This approach can be a good option
if you have a very limited number of options available. In terms of a broken printer for
example, one could try checking the ink levels, and if that doesn’t work, you could
check to make sure the paper tray isn’t jammed. Or maybe the printer isn’t actually
connected to a laptop. When using trial and error, one would continue to try different
solutions until the problem is solved. Although trial and error is not typically one of
the most time-efficient strategies, it is a commonly used one.
Working backwards is a useful heuristic in which you begin solving the problem by
focusing on the end result. It is common to use the working backwards heuristic to
plan the events of your day on a regular basis, probably without even thinking about
it.
Another useful heuristic is the practice of accomplishing a large goal or task by
breaking it into a series of smaller steps. Students often use this common method to
complete a large research project or long essay for school. For example, students
typically brainstorm, develop a thesis or main topic, research the chosen topic,
organize their information into an outline, write a rough draft, revise and edit the
rough draft, develop a final draft, organize the references list, and proofread their
work before turning in the project. The large task becomes less overwhelming when
it is broken down into a series of small steps.
The actual Tower of Hanoi problem consists of three rods sitting vertically on a base
with a number of disks of different sizes that can slide onto any rod. The puzzle
starts with the disks in a neat stack in ascending order of size on one rod, the
smallest at the top making a conical shape. The objective of the puzzle is to move
the entire stack to another rod obeying the following rules:
1. Only one disk can be moved at a time.
2. Each move consists of taking the upper disk from one of the stacks and
placing it on top of another stack or on an empty rod.
3. No larger disc may be placed on top of a smaller disk.
With 3 disks, the puzzle can be solved in 7 moves. The minimal moves required to
n
solve a Tower of Hanoi puzzle is 2 – 1, where 𝑛 is the number of disks. For example,
if there were 14 disks in the tower, the minimum amount of moves that could be made
14
to solve the puzzle would be 2 – 1 = 16,383 moves. There are various ways of
approaching the Tower of Hanoi or its related problems in addition to the
approaches listed above including an iterative solution, recursive solution, non-
recursive solution, a binary and Gray-code solutions, and graphical representations.
An iterative solution entails moving the smallest pieces over one, then moving the
next over one and if there is no tower position in the chosen direction you are moving
to, move the pieces to the opposite end, but then continue to move in the same
direction. By doing this one will complete the puzzle in the minimum amount of
moves when there are 3 disks. Recursive solutions represent recognizing that the
puzzle can be broken down into a series of sub problems to each of which the
same general solving procedures apply, and then the total solution can be found by
putting together the sub solutions. Non-recursive solutions entail recognizing that
the procedures required to solve the problem have many regularities such as when
counting the moves starting at 1, position of the disk in the series to be moved
during move 𝑚 represents the number of times 𝑚 can be divided by 2 which
indicates that every odd move involves the smallest disk. This allows for the
following algorithm:
1) Move the smallest disk to the peg that it has not recently come from.
2) Move another disk legally (there will only be one possibility).
A binary and Gray solutions describe disk move numbers in binary notation (base-2)
where there is only one binary digit (a bit) for each disk and the most significant
(leftmost bit) represents the largest disk. A bit with a different value to the previous one
means that the corresponding disk is one position to the left or right of the previous one.
Graphical representations, as their name imply, represent visual presentations of
conditions that can be modelled in order to view the most efficient and effective
solutions. A common graph for the Tower of Hanoi is represented by a unidirectional,
pyramid shaped graph, where different nodes (pieces within each level of the graph)
represent distributions of disks and the edges represent moves, as shown below.
Figure 1-1: Graphical representation of nodes (circles) and moves (lines) of
Tower of Hanoi.