Please enable JavaScript.
Coggle requires JavaScript to display documents.
Ch.21 Problem-solving Procedures - Coggle Diagram
Ch.21 Problem-solving Procedures
21.1 Problem-solving concepts
We can use computers as a tool and develop computer programs to generate solutions to solve complex problems
The need for a systematic way of solving problems
Solving a problem in an organized and systematic way can greatly enhance the chances of finding the best solution
In computer programming, we split a problem into several smaller and simpler parts which are called subproblems
We solve them individually and after that combine them together to give a whole solution to the original problem
This strategy is called divide and conquer
A series of intermediate steps are required to be developed in the process of finding the solution
Solving a problem in a systematic way means breaking a problem into smaller and more manageable modules
We can trace any mistake made in the process more easily by examining what is happening at every step
It is usually easier to solve a smaller module than a bigger one
Breaking a problem into smaller modules which are more manageable to us
Problem-solving
The process of analyzing the description of a problem until we reach a solution
21.2 Problem-solving Procedures
Six-step procedure of provlem-solving
Problem identification - Problem analysis - Algorithm design - Developing a solution - Debugging and testing - Documentation
Problem identification
The initial step of solving a problem
Obtain a precise definition of the problem
Asking question about the problem can help identify the problem more clearly
Problem analysis
Look into the problem from different perspectives in order to diagnose it correctly and gain a full picture of it
Identify the inputs, processing steps and outputs required for solving the problem
In-depth consideration of the identified problem
We can use an Input-Process-Output chart(IPO chart) to analyze the problem
Algorithm design
Algorithm
A finite sequence of steps arranged in specific logical order to generate a solution to a problem
two common ways to design and represent algorithms
Pseudocode
To represent an algorithm in narrative form
Flowchart
To represent the logic and actions of an algorithm graphically
Developing a solution
There are various techniques we can adopt in developing a solution for a problem
Top-down approach
A problem is divided into some manageable subproblems
The solutions to the subproblems join together and become the solution to the overall problem
Using this approach, we can avoid making mistakes in the process of developing a solution
We use the divide-and-conquer strategy to work from the abstract to the particular
By dividing the problem contains modules, each of which represents a problem
Using the technique of stepwise refinement
Each module has a specification
A module specification helps us understand how data is transmitted among modules
It includes:
A description of inputs(data received)
Processing steps(Logic used)
Outputs information returned
Debugging and testing
The checking processes required to ensure that a program fulfils the purposes for which it
was created
Debugging: The process of locating and fixing defects in a program
Testing: Ensure that a program works and is free of error
Three types of programming errors:
Syntax error
Run-time error
Logic error
The needs for documentation:
Help new comers familiarize themselves with the program easily
Help programmers discover errors in the program
Help programmers maintain the program in the future
Users can learn how to use the program through a user manual
21.3 Real-life Applications and Practical Considerations
21.4 Different Ways to Solve the Same Problems
The top-down approach: Start at the system level or the abstract level and divides the task into several manageable modules
The bottom-up approach: Start at the component level or the concrete level and the components are grouped together to from a system
Solve a problem systematically by top-down or bottom-up approach
The top-down approach can be more easily managed for a larger problem while the bottom-up approach is more suitable for a smaller one