The Problem Solving Process
The Problem Solving Process
The Problem Solving Process
In any field of study, problem-solving is a fundamental skill, and in computer science, this skill is
applied using computers. Whether the problem arises from the real world or an abstract concept, a
systematic approach is essential for finding solutions. Since computers are our tools for problem-
solving, it's crucial to understand how they process information. Typically, a computer with a CPU
(Central Processing Unit) follows a model where it takes input, processes it, and then produces
output. This basic model can be expanded to multiple CPUs in modern computers, but the core
principles of input, processing, and output remain the same. Understanding this model is the first
step toward effectively using computers to solve problems.
In problem-solving, we apply the model of computation where we start with some input
information, process it, and produce the desired output as the solution. While this basic model
works well for simple problems, more complex problems often require multiple iterations of the
input/process/output stages. These iterations produce intermediate results that help solve parts of
the problem before reaching the final solution.
The essence of problem-solving lies in how we handle the "process" part of this model. Therefore,
understanding and mastering this stage is crucial. Here's a simple definition of problem-solving
within this context:
Definition 1-1: Problem Solving is the sequential process of analyzing information related to a given
situation and generating appropriate response options.
Input: Collect all the grades, either by typing them in via the keyboard or by reading them from a
storage device like a USB flash drive.
Output: Display the average grade on a monitor, print it, or save it back to a storage device.
This simple example shows how the problem can be solved by following the input, process, and
output steps. As we dive deeper into problem-solving, we'll explore how to handle more complex
scenarios using this fundamental model.
Understanding the Problem
The first step in solving any problem is to ensure you fully understand it. This means identifying the
data provided, understanding what it represents, and knowing the expected output.
Example:
Input: Some grades might be numerical (e.g., 85, 90) and others in letter form (e.g., A-, C+).
Missing Data: Some students might not have grades due to absence.
To solve the problem, we must first understand the format of the grades:
The grades could be numbers ranging from 0 to 100 (e.g., 73 or 73.42), or they could be letter grades
like A to F.
The format matters because different types of data (numbers vs. letters) require different methods
of calculation.
We also need to address missing grades. If a student doesn’t have a grade, how should we handle it?
For example, if a student was absent, do we:
Formulating a Model
Once the problem is understood, the next step is to figure out how to process the available data.
This often involves breaking the problem into smaller, more manageable parts and using
mathematical formulas to get the desired result.
Definition
Formulating a model involves creating a formula or approach to process the input data. This
model helps us compute the result accurately. If no standard formula exists, we must develop
one.
Here, the grades are added up and divided by the number of students, resulting in a grade
between 0 and 100.
A+ = 12, A = 11, A- = 10
B+ = 9, B = 8, B- = 7
C+ = 6, C = 5, C- = 4
D+ = 3, D = 2, D- = 1
F=0
Once converted, we can apply a similar formula for calculating the average:
where 𝑦₁, 𝑦₂, …, 𝑦ₙ are the numerical equivalents of the letter grades.
Output Representation
The output can then be formatted as required:
If the output should be a percentage, you can use the first average directly or convert the second
formula’s result:
If the output should be a letter grade, you can use a lookup table to map the final number back
to a letter grade.
Develop an Algorithm
Having understood the problem and formulated a model, it is time to come up with a precise
Step 1: Start
Step 6: End
Pseudocode is a way to describe an algorithm using plain language and simple structures. It’s a
rough draft of a program's logic, written in a way that's easy to understand without worrying
about specific programming language syntax.
1. Start
2. Input number1
3. Input number2
4. Sum = number1 + number2
5. Output Sum
6. End
1. Start
2. Input number
3. If number modulo 2 equals 0
a. Output "Even"
4. Else
a. Output "Odd"
5. End
1. Start
2. Input number1
3. Input number2
4. Input number3
5. Average = (number1 + number2 + number3) / 3
6. Output Average
7. End
Test case
A test case is a set of conditions or variables used to determine whether a system or software
application behaves as expected. It typically includes a set of inputs, execution conditions, and
expected results.
Test Steps:
1. Input number1 = 10
2. Input number2 = 20
3. Input number3 = 30
4. Click on the "Calculate Average" button
Expected Result: The output should be 20.
Once the algorithm is defined, the next step is to convert it into a form that a computer can
execute. This process is known as writing the program, coding, or implementing an
algorithm.
Key Points
Coding: Refers to writing the actual code that implements the algorithm.
sum = 0
average = sum / 3
Introduction
Once a program has been written and compiled, the next critical step is to ensure that it performs
the intended task correctly. Testing the program involves running it with various inputs to verify its
accuracy and reliability.
Therefore, a program should be tested with a variety of input data to cover all possible scenarios.
Handling Errors:
A flaw in the algorithm itself, which does not account for certain situations.
Bugs:
Definition: Bugs are errors in a program that cause it to produce incorrect or undesirable results.
Oversights that cause the program to handle specific input cases incorrectly.
Debugging:
Definition: Debugging is the process of finding and fixing errors (bugs) in the program.
It involves systematically testing different cases to locate the issues and correcting them.
Introduction
After a program produces results, it is important to evaluate those results in the context of the
original problem. This step ensures that the output is not only correct but also meaningful and
in the required format.
Reconsider the Original Problem: Ensure the program’s output aligns with the original
problem and is in the correct format.
Interpreting the Results: Present the results in a clear and meaningful way that aids
decision-making, using tools like charts if needed.
Adjusting the Solution: If necessary, add more steps or data to fully solve the problem or
improve the solution’s effectiveness.
User Responsibility: It’s up to the user or programmer to ensure the solution truly solves
the problem; further adjustments may be needed.