Problem-solving
Problem-solving is the cognitive process of identifying, analyzing, and resolving challenges by
following a series of steps, from defining the problem to implementing and evaluating a solution.
It is a crucial skill for both personal and professional life, involving critical thinking, creativity,
and a structured approach to overcome obstacles and achieve goals.
Key steps in the problem-solving process
1. Identify and define the problem: Clearly and accurately state the problem you need to solve.
Ask questions like "who," "what," "where," and "why" to get a complete picture.
2. Brainstorm potential solutions: Generate a variety of possible solutions without initial
judgment. Thinking creatively and considering different perspectives can lead to innovative
outcomes.
3. Evaluate the alternatives: Analyze the potential solutions you've brainstormed, considering
their pros and cons, feasibility, and potential impact.
4. Decide on and implement the solution: Choose the best-fitting solution and put it into action.
The implementation phase might require a plan and coordination.
5. Evaluate the outcome: After implementing the solution, assess its effectiveness. Did it solve the
problem? Did it create any new issues? This step is crucial to ensure the problem is resolved and
to learn from the process
Problem Analysis Charts
A Problem Analysis Chart (PAC) is a structured tool used to break down a problem into key
components. It helps to systematically understand the problem, identify necessary data, and
develop a structured approach to solve it. In the context of algorithms and flowcharts, PACs
serve as the initial step in problem-solving by organising information that will be used to
visualise and implement the solution.
Let us take a simple case to find the area of a regular geometry. We will break the problem into
small components so that we can arrive at a solution.
PACs for Different Geometries
We will start our discussion with a simple method to find the area of the case of a square. The
PAC breaks the problem into smaller parts. It helps us to bring a logical sequence to our thought
process and help us arrive at better solutions. For now, let us see how we can bring out a
solution.
Finding the Area of a Square
For a regular geometry, we will need some parameters about the same. For instance, we know
that a square has all right angles and it is a four-sided figure. We also know that to find the area
of a square, we will need the information about the length of one side
Problem Analysis Chart: Area of a Square
Identifier Use Case Example Input Output
Side length of the
Given Data Side length (s) Area (A)
square
Problem Analysis Chart: Area of a Square
Identifier Use Case Example Input Output
Required Results Calculate the area Side length (s) Area (A = s2)
Processing Formula for area s A = s2
Solution Centimeters, Inches, Area in given
Use different units
Alternatives Meters unit
You will find that the logical steps are the same for many similar problems. You please try to
develop a problem analysis chart for finding the area of a circle and then a rectangle. Although
the solution is given, try to work on it independently.
Finding the Area of a Circle
Problem Analysis Chart: Area of a Circle
Use Case
Identifier Input Output
Example
Given Data Radius of the circle Radius (r) Area (A)
Required Results Calculate the area Radius (r) Area (A = πr2)
Processing Formula for area r A = πr2
Solution Centimeters, Inches, Area in given
Use different units
Alternatives Meters unit
Finding the Area of a Rectangle
Problem Analysis Chart: Area of a Rectangle
Identifier Use Case Example Input Output
Length and width of the
Given Data Length (l), Width (w) Area (A)
rectangle
Area (A = l *
Required Results Calculate the area Length (l), Width (w)
w)
Processing Formula for area l, w A=l*w
Solution Centimeters, Inches, Area in given
Use different units
Alternatives Meters unit
Interactive Activity: Compute Area of a Rectangle
Is using a formula the only way to compute areas, actually - No. You will find that you could
also divide the rectangle into strips. Adding the areas of these strips should also give you the area
of the figure. Here is a visual demonstration of the same.
Enter the length and width of the rectangle (integers only). When you press compute, the figure
will be filled with strips, and their areas will be summed to give the total area.
Compute
Problem Analysis Chart and Flowchart for Area of a Rectangle through Addition
Problem Analysis Chart: Area of a Rectangle through Addition
Identifier Use Case Example Input Output
Length and width of the Length (l), Width
Given Data Area (A)
rectangle (w)
Calculate the area through a Length (l), Width
Required Results Area (A = l * w)
series of additions (w)
Add width repeatedly, length A = w + w + ...
Processing l, w
times (l times)
Solution Centimeters, Inches, Area in given
Use different units
Alternatives Meters unit
Yes
No
Start
Enter length (l) and width (w)
Initialize area = 0
Is length > 0?
Add width to area
Decrement length
End - Display Area
We know that there is more than one method to solve a problem. Each problem comes with a
cost. For instance, if we do not know the range of values that can be true, using a binary search
might not be really possible. In any case, in my experience, when we use a program to solve a
problem, we will be able to tackle more complex problems.
How PACs, Algorithms, and Flowcharts Interrelate
PACs, algorithms, and flowcharts are interconnected in problem-solving:
PACs provide a structured approach to analyse the problem by identifying inputs,
outputs, processes, and alternative solutions.
Flowcharts visually represent the steps and decision points outlined in the PAC, making
it easier to understand and communicate the solution process.
Algorithms are step-by-step procedures derived from the PAC and visualised through
flowcharts. They provide a logical sequence of operations to solve the problem.
By integrating PACs, algorithms, and flowcharts, we can systematically analyse problems,
visualise the solution process, and implement efficient solutions. This structured approach
enhances our problem-solving skills and ensures that solutions are well-organized, efficient, and
easy to understand. The interactive activity demonstrates how a simple algorithm can be
visualised and implemented, reinforcing the concepts of PACs and flowcharts in a practical
context.
FLOWCHART
The flowchart is a diagram which visually presents the flow of data through processing
systems. This means by seeing a flow chart one can know the operations performed and the
sequence of these operations in a system. Algorithms are nothing but sequence of steps for
solving problems. So a flow chart can be used for representing an algorithm.
A flowchart, will describe the operations (and in what sequence) are required to solve a given
problem. You can see a flow chart as a blueprint of a design you have made for solving a
problem.
Flowchart Symbols
There are 6 basic symbols commonly used in flowcharting of assembly language Programs:
Terminal,
Process,
input/output,
Decision,
Connector and
Pre defined Process.
Problem1: Flow chart to calculate the area of circle.
Problem3: Flow chart to find the greatest from 2 numbers.
Problem4: Flow chart to print the Even numbers between 9 and 100.
Problem 5: Flow chart for printing odd numbers less than a given number. It should also
calculate their sum and count.
Problem6: Flow chart for the calculate the average from 25exam scores.
A Pseudocode is defined as a step-by-step description of an algorithm. Pseudocode does not
use any programming language in its representation instead it uses the simple English language
text as it is intended for human understanding rather than machine reading.
Pseudocode is the intermediate state between an idea and its implementation(code) in a
high-level language.
What is the need for Pseudocode
Pseudocode is an important part of designing an algorithm, it helps the programmer in
planning the solution to the problem as well as the reader in understanding the approach to the
problem. Pseudocode is an intermediate state between algorithm and program that plays
supports the transition of the algorithm into the program.
Before writing the pseudocode of any algorithm the following points must be kept in mind.
Organize the sequence of tasks and write the pseudocode accordingly.
At first, establishes the main goal or the aim. Example:
This program will print first N numbers of Fibonacci series.
Use standard programming structures such as if-else, for, while, and cases the way we use
them in programming. Indent the statements if-else, for, while loops as they are indented in
a program, it helps to comprehend the decision control and execution mechanism. It also
improves readability to a great extent. Example:
IF "1"
print response
"I AM CASE 1"
IF "2"
print response
"I AM CASE 2"
Use appropriate naming conventions. The human tendency follows the approach of
following what we see. If a programmer goes through a pseudo code, his approach will be
the same as per that, so the naming must be simple and distinct.
Reserved commands or keywords must be represented in capital letters. Example: if you
are writing IF…ELSE statements then make sure IF and ELSE be in capital letters.
Check whether all the sections of a pseudo code are complete, finite, and clear to
understand and comprehend. Also, explain everything that is going to happen in the actual
code.
Don't write the pseudocode in a programming language. It is necessary that the pseudocode
is simple and easy to understand even for a layman or client, minimizing the use of
technical terms.
Pseudocode Examples:
1. Binary search Pseudocode:
Binary search is a searching algorithm that works only for sorted search space. It repeatedly
divides the search space into half by using the fact that the search space is sorted and checking
if the desired search result will be found in the left or right half.
Example: Given a sorted array Arr[] and a value X, The task is to find the index at which X is
present in Arr[].
Below is the pseudocode for Binary search.
BinarySearch(ARR, X, LOW, HIGH)
repeat till LOW = HIGH
MID = (LOW + HIGH)/2
if (X == ARR[mid])
return MID
else if (x > ARR[MID])
LOW = MID + 1
else
HIGH = MID - 1