PROBLEM SOLVING TECHNIQUES
A problem in computer science is a task or set of tasks that need to be performed. It
can be represented as a function that maps inputs to outputs.
A problem definition should include the initial state, the goal state, and the steps required to
reach the solution.
Program is the set of instructions which is run by the computer to perform specific task. The task of
developing program is called programming.
Examples of problems
Addition: Add any two numbers
Increment: Add 1 to any number
Ternary addition: Add any three numbers
Sorting: Sort any list of names
Decision problems: Problems where the answer is either yes or no
Factoring: Find the prime factors of a positive integer
SOLVING A PROBLEM
Problem-solving techniques are methods for identifying and addressing
problems. They often involve a series of steps, such as defining the problem,
generating solutions, and evaluating the outcome.
A problem can be solved by an algorthim,which is a method or process for solving the
problem.
So for solving any problem Algorthim must be correct,finite in length and terminate
for all inputs.
A set of sequential steps usually written in Ordinary Language to solve a given problem is called
Algorithm
3. Write an algorithm to find the largest of three numbers X, Y,Z.
Step 1: Read the numbers X,Y,Z.
Step 2: if (X > Y) Big = X else BIG = Y
Step 3 : if (BIG < Z)
Step 4: Big = Z
Step 5: Print the largest number i.e. Big Step 6: Stop
Flowchart
A flow chart is a step by step diagrammatic representation of the logic paths to
solve a given problem. Or A flowchart is visual or graphical representation of an
algorithm.
The flowcharts are pictorial representation of the methods to b used to solve a
given problem and help a great deal to analyze the problem and plan its solution in
a systematic and orderly manner. A flowchart when translated in to a proper
computer language, results in a complete program.
Problem solving aspects:
It widely recognize that,there are many ways to solve the problem and many
solutions to the problem.
For solving any problem, there is no universal method, to solve the problem,we
must try the exact problem statement.
So, from problem statement,we devlop the algorthim.
Similarities among problem:
If the problem has some similarities, then other problem also be solved,by discover
the new problem.
Ex . sorting( bubble sort,insertion sort,quick sort,selection sort)
(Bubble sort)
(Selction sort)
PROBLEM INSTANCE
A problem instance refers to the input,constraintand
expected output of a problem that needs to be solved. It
includes all the necessary information and data required to
find a solution.
Ex: sorting the number [1,7,6,3,2]
Ascending : [1,2,3,6,7]
Desc:[7,6,3,2,1]
Generalization and special cases
Generalization and specialization are the key of
mathematical thinking.
Concept of generalization
Generalization draws conclusion from observed patterns
in specific cases.
Concept of special case
Special case are specific ,where the instances are the
generalized problems