Problem-Solving Process: Computer As A Model of Computation
Problem-Solving Process: Computer As A Model of Computation
The problem-solving process using a computer involves a structured approach where the
computer acts as a model of computation to solve a problem efficiently. This process breaks
down complex problems into simpler steps that a computer can execute. Let's explore the
problem-solving process with a focus on how the computer is used as a model of
computation.
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.
This simple example shows how the problem can be solved by following the input, process,
and output steps.
The first step is to clearly understand what the problem is asking. This means identifying the
data provided, understanding what it represents, and knowing the expected output.
2. Formulating a Model
Area=Length × Width
This formula represents the model we will use to solve the problem.
3. Developing an Algorithm
1. Start
2. Input the length of the rectangle.
3. Input the width of the rectangle.
4. Multiply the length by the width to get the area.
5. Output the area.
6. End
Two commonly used representations for an algorithm is by using (1) pseudo code, or (2)
flowcharts.
Pseudocode
Pseudocode is a structured way of writing an algorithm that resembles programming languages but
doesn't follow any specific syntax rules. It helps bridge the gap between the algorithm and actual
code. It's more formal than the plain algorithm and can easily be translated into code, but it avoids
specific language syntax.
1. Start
Flochart
A flowchart is a diagram that visually represents a process or a sequence of steps involved in solving
a problem. Each step in the process is depicted by different shapes (like ovals, rectangles, and
diamonds) and is connected by arrows that show the flow of the process.
Once the program is written, it needs to be tested with various inputs to ensure it works
correctly.
Example:
Test case 1:
o Input: Length = 5, Width = 4
o Output: The area of the rectangle is: 20
Test case 2:
o Input: Length = 7, Width = 3
o Output: The area of the rectangle is: 21
Finally, after testing, evaluate whether the solution is correct and efficient. Ask:
Does the program correctly compute the area for all inputs?
Are there any cases where it might fail (e.g., negative inputs)?
Could it be improved in any way?
For example, we could add a check to ensure that the length and width are positive values.