0% found this document useful (0 votes)
23 views

Lecture 2

The document introduces problem solving methods in computing. It discusses four levels of problem solving: understanding the problem, designing a plan, executing the plan, and evaluating the solution. It also outlines seven steps for problem solving: defining the problem, designing a solution, refining the solution, developing a testing strategy, coding and testing the program, documenting the project, and maintaining the program. Pseudocode and flowcharts are presented as ways to represent algorithms and solutions.

Uploaded by

Chuks Valentine
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Lecture 2

The document introduces problem solving methods in computing. It discusses four levels of problem solving: understanding the problem, designing a plan, executing the plan, and evaluating the solution. It also outlines seven steps for problem solving: defining the problem, designing a solution, refining the solution, developing a testing strategy, coding and testing the program, documenting the project, and maintaining the program. Pseudocode and flowcharts are presented as ways to represent algorithms and solutions.

Uploaded by

Chuks Valentine
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Study Session 2: Introduction to Problem Solving Methods I

Introduction
Not all problems can be solved with a computer system. Categories of problems that cannot
be solved with a computer system are called non computable problems while problems that
can be solved with a computer system are called computable problems

In this study session, you will be introduced to the introduction to problem solving methods
which comprise four steps: understanding the problem, designing a plan, executing the plan
and evaluating the plan. Also, seven main steps of problem solving will be discussed in the
study session as well.

Learning Outcomes for Study Session 2


On completion of this study session, you should be able to:

2.1 Define the concept of Problem Solving and itemize the four levels involved in problem
solving

2.2 Explain the Steps involved in problem solving.


2.1 Problem Solving in Computing Field

Problem solving involves analysing a problem and deducing a way to solve the problem. The
problem to be solved can come from any real world problem or even an abstract world. Hence,
there is a need for a standard and systematic approach to solving problems. Problems in the field
of computing can either be computable or non-computable.

Box 2.1: Computable and non-computable Problem

A computable problem is a problem that can be solved using principles of computing while non-
computable problems are problems that cannot be solved using any principles of computing

2.1.1 Four Levels of Problem Solving


In computing, there are four levels towards solving any computational problem:

a. Understanding the problem


Understanding the first step can be very difficult but it is advisable to understand the
problem before moving to the next step. It may happen sometimes when you attempt to
answer a question that is not fully understood in the question. Therefore, one must find the
given data, what the unknown (the required result) is and what the relationship that links the
given data with the unknown is. It is also important to verify that the given information is
sufficient to solve the problem.

b. Devising a plan
Once the problem is understood, one must devise the plan of action to solve the problem. A
plan is formed by proceeding from the data to the result according to the relationship that
links them. If the problem is trivial, this step will not require much thinking. General
techniques include the following:
c. Executing the plan
Once the plan is defined, it should be followed completely. Each element of the plan should be
checked as it is applied. If parts of the plan are found to be unsatisfactory, the plan should be
revised.

d. Evaluating the Solution

Finally, the result should be examined in order to make sure that it is valid and that the
problem has been solved.

Box 2.2: Problem Solving

Problem solving involves analysing a problem and deducing a way to solve the problem.

Pilot Question 2.1


1. Explain the term “Problem Solving”.
2. Itemize the four levels of Problem Solving.

2.2 Steps involved in Problem Solving


In the field of computer science, there are Seven (7) steps you need to follow in order to solve a
problem. These can be represented in the box below:

2.2.1 Problem Definition


A detailed definition of a problem is the first step towards solving any problem. You need to
define programs to solve questions like the following:

i. What input data/information is available?


ii. What does it represent?
iii. Do I have everything that I need?
iv. What output information am I trying to produce?
v. What do I want the result to look like … text, a picture, a graph?
vi. What am I going to have to compute? An answer to this question will help you in
having detailed understanding of what a program definition should look like.

2.2.2 Solution Design


In this step, you should be able to define a solution. Starting from the original problem, you
divide it into a number of sub-problems. These sub-problems, being necessarily smaller than
the original problem, are easier to solve and their solutions will be the components of our final
solution.
The same “divide and conquer” method is applied in turn to the sub-problems until the whole
problem has been converted into a plan of well-understood steps.

To illustrate this step, let’s take a simple non-computer problem such as the recipe for
Cream Horns. Based on this recipe, we can break down the problem into three sub-problems:

1. Make the horns,


2. Prepare whipped cream, and
3. Finish the horn.

2.2.3 Solution Refinement


An algorithm is a detailed refinement of solution which can be defined as a step to step guide to
solving a problem. To develop an algorithm, you need to represent the instructions in a way that is
understandable to a person who is trying to figure out the steps involved.

ALGORITHM

PSEUDOCODE FLOWCHART
Figure 2.1: Representations of Algorithm

2.3: PSEUDOCODE

Pseudo-code is a simple and concise sequence of English-like instructions to solve a problem.

Algorithms can also be represented with a flow chart but a simple approach to this is to first
represent it as a pseudo-code, then converting the pseudo-code to a flowchart.

Box 2.4: Flowchart

Flowchart is a graphic representation of the steps required in solving a problem.

Example 2.1
Consider an electrician trying to replace burnt out box with new ones. To replace the burnt
bulb, he must first check if the bulb is burnt or not. If it’s burnt, he replaces the bulb, else
leaves the bulb. To solve this problem, the electrician wrote down the pseudo-code and the
flowchart he needs in order to solve the problem. The pseudo-code for the problem is
represented as follows:

1. IF lamp works, go to step 7.


2. Check if lamp is plugged in.
3. IF not plugged in, plug in lamp.
4. Check if bulb is burnt out.
5. IF blub is burnt, replace bulb.
6. IF lamp doesn’t work buy new lamp.
7. Quit ... problem is solved

The flowchart representation of the problem is indicated in Figure 2.2:

START

STOP
Figure 2.2: Flowchart Representation of Bulb Replacement Problem

Considering the definitions of pseudo-code and flowchart given above identify the major
similarities and differences between pseudo-code and flowchart.
2.2.4 Testing Strategy Development
Now that the detailed steps for solving the problem has been done. There is a need to testing the
algorithm from the first step to the last step of a set of instructions that can be understood by the
computer. This involves testing the strategy development of a program in any high level
programming language of your choice. For all test cases, the expected results must be computed
and specified before proceeding to the next step. Complete test cases can then be used to check
algorithms and programs efficiently.

2.2.5 Program Coding and testing


Here, you should be able to adapt to the program coding steps and testing of the program should
follow when writing a program. Pseudo-code algorithms cannot be executed directly by the
computer because is going to be converted to a flow chart, therefore Pseudo-code must first be
translated into any programming language, and a process is referred to as coding.

The pseudo-code produced by solution refinement, in Step 3, is used as a blueprint for the
program. Depending on the programming language used, program will be used and testing
should follow in order to meet up with requirements of our problem solving.

2.2.6 Documentation
Here, documentation should begin with the first step of program development and continues
throughout the lifetime of the program. A program’s documentation must include the
following:

i. Explanations of all of the steps of the method

ii. The design decisions that were made

iii. The problems that were encountered during the writing and testing of the program.

The final documentation must also include a printed copy of the program, called a program
listing. This listing should be made readable by careful layout as one does with a technical
report, which is what the written form of the program really is: a written description of the
computer solution of the problem. Programs can be made easier to understand by the reader if
all of their complex parts include explanations in the form of comments.
Later, when the program must be changed, these explanations will make the changes easier to
implement. To be complete, the documentation must include some user instructions. For
programs that will be used by people unfamiliar with computers, it is necessary to include a
user’s manual that explains, without using technical jargon, how to use the program, how to
prepare the input data and how to interpret the program’s results.

Enumerate the steps involved in project documentation

2.2.7 Program Maintenance.


Finally, Program maintenance includes all the activities that occur after a program becomes
operational. The term “maintenance”, when applied to programs, has a somewhat different
meaning from normal usage. Houses, cars and other objects need maintenance because they
deteriorate through use. Programs, on the other hand, have no physical properties, only
logical properties they do not need repainting and they do not wear out through use.

When you run the same program a thousand of times, some of the hardware components of the
computer may wear out and need maintenance but the program can’t wear out. However, a
program can work properly nine hundred and ninety-nine times and then fail during the
thousandth run.

This may give the appearance that the program has worn out, but actually the program
encountered an unusual set of circumstances.

In other words, the program did not fail because it had worn out, it failed because it did not
work properly to begin with; it was never tested for this particular set of circumstances. If
the unusual circumstances had occurred on the first run instead of the thousandth, the program
would have failed on the first run. Thus, program maintenance is largely completing the
process of implementation.

What do you understand by the term “Program Maintenance?”


Program maintenance includes:

i. eliminating newly detected program errors

ii. modifying the current program

iii. adding new features to the program

iv. updating the documentation

Maintenance documentation is produced specifically to help the “maintainers” in their


work, may include design documents, program code, and information about testing. Often,
the cost of program maintenance over the lifetime of a program surpasses the development
costs for the original program.

2.3 General Techniques in Problem Solving


General techniques involved in solving a Problem are enumerated below:

1. Finding if there are known similar problems


2. Reshaping the original problem so that it resembles a known problem
3. Restricting the problem to a shorter solvable form
4. Generalizing a restricted problem
5. Finding existing work that can help in the search for a solution.

Pilot Question 2.2


1. Enumerate the steps involved in Problem Solving
2. Itemize the steps involved in Program Maintenance.
3. What makes up a Program Documentation?
4. Highlight the general techniques used in solving a Problem.
5. Considering the definitions of pseudo-code and flowchart given above, identify the
major similarities and differences between pseudo-code and flowchart.
Summary of Study Session 2
In Study Session 2, you have learnt that:

1. A computable problem as Problem that can be solved with a Computer System.


2. A non-computable problem is a problem that cannot be solved with a computer system.
3. Problem solving involves analysing a problem and deducing a way to solve the problem.
4. There are four levels of problem solving namely: understanding the problem, designing a
plan, executing the plan and evaluating the plan.

5. Steps involved in problem Solving are: Program Definition, Definition Design, Solution
Refinement, Testing Strategy Development, Program coding and testing, Documentation
Completion and Program Maintenance.

6. Program maintenance includes: Eliminating newly detected error, modifying current


program, adding new features to the problem and updating the documentation.

7. Maintenance documentation, produced specifically to help the “maintainers” in their


work, may include design documents, program code, and information about testing.
Often, the cost of program maintenance over the lifetime of a program surpasses the
development costs for the original program.

You might also like