SlideShare a Scribd company logo
2
Most read
3
Most read
6
Most read
(UNIT-4 ) PPA Notes by: Mansi Tyagi
PPA (UNIT - 5)
INTRODUCTION TO Problem Solving
In general, in our daily life ,we face a variety of problems that may be
related to any field. The same problem can be solved in different way by
different person and the techniques used for the solution by someone
may be correct.
 The nature of the problem depends on the situation.
 Problem solving may be an art or science.It includes special
knowledge in the fields to which the problem relates to and power
of knowledge without learning,human reasoning and experience.
 In problem solving each individual may have his or her own
unique way.
Therefore ,prior to the solution of any problem one should follow the
following basic steps that may give a clear and better idea for the
solution of any problem:
Framework for problem solving:
STEP1: Understanding the problem
In this step you should try to understand the actual problems by asking
the following basic questions:
 Can you state the problems in your own words?
 What are you trying to find or do?
 What are unknowns?
(UNIT-4 ) PPA Notes by: Mansi Tyagi
STEP2: Devising a Plan/Making a plan of solution
Its very useful to prepare a good plan for the solution of given problems:
 Look for a pattern
 Examine related problems.
 Make a table,diagrams & equation if required
 Use quess and check
STEP3: Carrying out the plan
Implement the strategies in step 2 and perform any necessary actions or
computations.This may be a formal proof of each step.finally keep an
accurate record of your work for further use.
STEP4: Looking back/Verifying
After successful carrying out the plan,following should be checked:
 Check the results in the original problem.
 Interpret the solution in terms of the original problem.
BRB11
PROBLEM SOLVING TECHNIQUES
TRIAL AND ERROR
TECHNIQUES
BRAIN STORMING
TECHNIQUES
DIVIDE & CONQUER
TECHNIQUES
(UNIT-4 ) PPA Notes by: Mansi Tyagi
1. TRIAL AND ERROR TECHNIQUE//METHOD :
Some complex problems can be solved by a technique that is called trial
and error.Trial and error is typically good for problems where you have
multiple chances to get the correct solution.
 The purpose of trial and error is not to find out why a problem was
solved.its primarily used to solve the problem.
 Trial and error is used to find a single solutions to a single
problem.
 Trial and error is used best when it is applied to situations that give
your large amounts of time and safety to come up with a solution.
For example :while trial and error may be excellent in finding solutions
to mechanical or engineering problems.
Advantages :
 It does not require you to have a lot of knowledge.
 It also plays an important role in the scientific method as well.
 Trail and error is also an excellent tool for inventors.
2. BRAIN STORMING TECHNIQUES :
“Brainstoring is a group method for obtaining new ideas and business
solutions.The groups are organized for sitting together and stimulate
(UNIT-4 ) PPA Notes by: Mansi Tyagi
greater creativity by exchange of mutual experiences and participating in
the discussions.”
 Brainstorming can be an effective way to generate lots of ideas on
a specific issue and then determine which ideas is the best solution.
 It is most effective with groups of 8-12 people and should be
performed in a relaxed environment.If participants feel free to
relax and joke around,they will stretch their minds further and
therefore produce more creative ideas.
For example: It is commonly used for advertising,the development
of new products,process management and business planning.
There are four basic rules in brainstorming :
1. No Criticism : Criticism is reserved for the evaluation stage of
the process.This allows the members to feel comfortable with
the idea of generating unusual ideas.
2. Welcome unusual ideas :Unusual ideas are welcomed as it is
normally easier “tame down” than to “tame up ” as new ways of
thinking and looking at the world may provide better solutions.
3. Quantity wanted: The greater the number of ideas
generated,the greater the chance of producing an effective
solution.
4. Combine and improve ideas: combine ideas in order to make
them better.
Advantages :
 Encouraged creative thinking
 All ideas are accepted.
(UNIT-4 ) PPA Notes by: Mansi Tyagi
 Makes everyone part of team
 Easy and simple technique.
STEPS OF BRAINSTORMING :
3. DIVIDE AND CONQUER TECHNIQUES :
In the technique,the main problem is divided into several smaller sub
problems and then it is solved recursively.At last combine these
solutions to create the solution of the original problem.
Divide and conquer approach normally follow the following
steps-
Define the problem /Explain the topic
Set a time limit
Encourage Ideas
Records the ideas
Clarifying
Evaluate ideas
Create possible solution
(UNIT-4 ) PPA Notes by: Mansi Tyagi
 Divide : Divide the original problem into a set of sub problems
 Conquer : Solve each sub problem individually and recursively
if required.
 Combine: Finally, combine the solutions of the sub problems
into a solution of the entire original problem.
Divide and conquer strategy
PROBLEM OF SIZE “n”
Subproblem 2 of size n/2Subproblem 1 of size n/2
Solution to Subproblem 1 Solution to Subproblem 2
Solution to the
Original Problem
(UNIT-4 ) PPA Notes by: Mansi Tyagi
Seven Steps to Problem Solving
1.Define & identify the problem:
The first step is critical .its essential for each group member to
cearly understand the problem so that all energy will be focused in the
same direction.
2.Analyze the problem :
In this stage of problem solving, questions should be asked and
information gathered. Do not make the mistakes of assuming you know
what is causing the problem without an effort to fully investigate the
problem you have defined.
Define and Identify the problem
Analyze the problem
Identifying possible solutions
Selecting the best solutions
Evaluate Solutions
Develop an Action Plan
Implement the Solution
(UNIT-4 ) PPA Notes by: Mansi Tyagi
3.Identifying possible solution:
Identifying possible solutions to the problem is sometimes referred
to as finding “Optional solutions” because the goal is to complete a list
of all conceivable alternatives to the problem.
4. Selecting the best solution:
Decision making can be seen as bringing one into an ambivalent
relationship with both power and responsibility.
5.Evaluating Solutions:
There are several ways to evaluate the chosen solution,and writing
them all down will help the group to choose the best solution to the
problem.
6. Develop an Action Plan:
An action plan is a chart that lists the tasks that need to be done
and identifies who will be responsible for each,when and what action is
necessary ,where to start,and how.
 Divide the solution into sequential tasks
 Develop the contingency plans.
7.Implement the solution :
Showing that the problem solving process organized and orderly
process will convince others that the solution is valid.
(UNIT-4 ) PPA Notes by: Mansi Tyagi
ALGORITHM
A algorithm is a procedure or formula for solving a problem.It can
defined as a step-by-step procedure to solve a particular problem or
program.
 An algorithm is a sequence of finite instructions used for
calculations and data processing.
 It’s a type of effective method in which a lsit of well-defined
instructions for completing a task will,when given an initial
state,proceed through a well defined series of successive
states,eventually terminating in an end-state.
 Five Characterstics of Algorithm :
1.Input: It may accept zero or more input.
2.Output: It should produce at least one output.
3.Definiteness:Each instruction must be clear ,well defined and
precise.There should not be an ambiguity.
4.Finiteness: It should be a sequence a finite instructions i.e;it should
end after a fixed time.
5.Effectiveness: Steps are sufficiently simple and basic.
 Notations for algorithm:
1.Name of the algorithm
2.Step numbers
3.Explanatory comment
4.Termination
(UNIT-4 ) PPA Notes by: Mansi Tyagi
 Essential properties of an algorithm :
 It must be concise
 It must be unambiguous
 It must be simple
 It should lead to a unique solution of the problem
 It must be capable of machine execution
 Advantages :
 Easy to debug
 It is independent of programming languages.
 It has a definite procedure.
 Disadvantages:
 It is cumbersome and time consuming
 Example 1: Write an algorithm to determine a student’s final
grade and indicate whether it is passing or failing. The final grade
is calculated as the average of four marks.
Step 1: Start
Step 2: Input M1,M2,M3,M4
Step 3: GRADE  (M1+M2+M3+M4)/4
Step 4: if (GRADE < 50) then
Print “FAIL”
else
Print “PASS”
Step 5: Stop
(UNIT-4 ) PPA Notes by: Mansi Tyagi
 Example 2: Write an algorithm that reads three numbers and
prints the value of the largest number.
Step 1: Start
Step 2: Input N1, N2, N3
Step 3: if (N1>N2) then
if (N1>N3) then
[N1>N2, N1>N3]
else
[N3>N1>N2]
endif
else
if (N2>N3) then
[N2>N1, N2>N3]
else
[N3>N2>N1]
endif
endif
Step 4: Print “The largest number is”, MAX
Step 5 : Stop
(UNIT-4 ) PPA Notes by: Mansi Tyagi
 Example 3:To print pascal triangle (Important algo.)
Step1:START
Step2:Read n
Step3: For i=1 to n in steps of 1
Begin
For i=1 to (n-i)in steps of 1
Begin
Print “ “
I=i+1
End
For k=1 to (k<i)in steps of 1
Begin
Print k
K=k+1
End
For k=i to 1 in steps of 1
Begin
Print k
K=k-1
End
Print from new line
i=i+1
End
Step4: STOP
(UNIT-4 ) PPA Notes by: Mansi Tyagi
Pseudo Code: is an artificial and informal language that helps
programmers develop algorithms. Pseudo code is very similar to
everyday English.
 Example 1: Write an algorithm to determine a student’s final
grade and indicate whether it is passing or failing. The final grade
is calculated as the average of four marks.
Pseudo code:
 Input a set of 4 marks
 Calculate their average by summing and dividing
by 4
 if average is below 50
Print “FAIL”
else
Print “PASS”
(UNIT-4 ) PPA Notes by: Mansi Tyagi
Flowchart
A Flowchart
 shows logic of an algorithm
 emphasizes individual steps and their interconnections
 e.g. control flow from one action to the next
 Flow chart is diagrammatic representation of an algorithm. It is built using
different types of boxes of symbols. The operation to be performed is
written in the box. All symbols are interconnected by arrows to indicate the
flow of information and processing.
Following are the standard symbols used in drawing flowcharts.
Oval Terminal Start/stop/begin/end
symbol
Parallelogram Input/Output Making data available for
processing (input) or
recording of the
processed
information(output)
Rectangle Process Any processing to be
performed. An
assignment operation
normally represented by
this symbol
Diamond Decision Decisionorswitchingtype
of operations that
determines which of the
(UNIT-4 ) PPA Notes by: Mansi Tyagi
alternative paths is to be
followed.
Circle Connecter Used for connecting
different parts of flow
chart.
Arrow Flow Joins two symbols and
also represents
executions flow.
 `Advantages:
 Communication: flowcharts are better way of
communicating the logic of a system to all concerned.
 Effective analysis: with the help of flowchart problem
can be analyzed in more effective way.
 Proper documentation
 Efficient coding
 Proper debugging
 Efficient program maintenance
 Disadvantages:
 Complex logic
 Alternativess and modifications
 Reproductions
 Time-consuming
 Subjective
(UNIT-4 ) PPA Notes by: Mansi Tyagi
 Example :Draw a flowchart that will read the two sides of a
rectangle and calculate its area.
Complexity
It is very convenient to classify algorithms based on the relative amount
of time or relative amount of space they require and specify the growth
of time/space requirements as a function of the input size.
TYPES OF COMPLEXITY ARE:
1.SPACE COMPLEXITY
2. TIME COMPLEXITY
(UNIT-4 ) PPA Notes by: Mansi Tyagi
1. Space complexity:
Space complexity of an algorithm is the amount of memory it needs to
run to completion.
S(x)= c+Sx
S(x) is the space required by a problem x
C is a constant
Sx is an instance characterstic
2.Time Complexity :
Time complexity of an algorithm signifies the total time required by the
program to run to completion. The time complexity of algorithms is
most commonly expressed using the big O notation.
Time Complexity is most commonly estimated by counting the number
of elementary functions performed by the algorithm. And since the
algorithm's performance may vary with different types of input data,
hence for an algorithm we usually use the worst-case Time
complexity of an algorithm because that is the maximum time taken for
any input size.
Some of the reasons for studying time complexity are:
 We may be interested to know in advance that whether an
algorithm/program will provide a satisfactory real time response.
 There may be several possible solutions with different time
requirements.
(UNIT-4 ) PPA Notes by: Mansi Tyagi
Types of Notations for Time Complexity
Now we will discuss and Big Oh denotes "fewer than or the same as" <expression>
iterations.
1. Big Omega denotes "more than or the same as" <expression> iterations.
2. Big Theta denotes "the same as" <expression> iterations.
3. Little Oh denotes "fewer than" <expression> iterations.
4. Little Omega denotes "more than" <expression> iterations.
Understanding Notations of Time Complexity with Example
 O (expression) is the set of functions that grow slower than or at the same rate
as expression.
 Omega (expression) is the set of functions that grow faster than or at the same
rate as expression.
 Theta (expression) consist of all the functions that lie in both O(expression) and
Omega expression.
(UNIT-4 ) PPA Notes by: Mansi Tyagi
Big Oh Notation
Big-oh notation is the formal method of expressing the upper bound of
an algorithm’s running time. It is the measure of the longest amount of
time it could possibly take for the algorithm to complete.
We have O(f) called big-oh,which represents the class of functions that
grow no faster than f.
It is used in computer science to describe the performance or complexity
of an algorithm.
Use of Big Oh Notation
Big oh notaion has two main areas of application:
 In computer science, big oh notation is used to classify algorithms
by how they respond to changes in input size.
 In mathematics, big oh notation is used to describe the limiting
behaviour of a unction when the argument tends towards a
particular value or infinity, usually in terms of simpler functions.
 It is also used in many other fields to provide similar estimates.
(UNIT-4 ) PPA Notes by: Mansi Tyagi
IMPORTANT QUESTIONS
Q1. Describe the relevance and importance of problem solving
techniques.
Q2. What do you understand bythe pseudocode?
Q3. What is divide and conquer techniques to solve a problem?Explain
it by giving an example.
Q4. Write the short note on brainstorming?
Q5. Discuss the different techniques for problem solving with help of
examples?
Q6. Explain various steps involved in problem solving?
Q7. What is big-oh notation? Explain its use.
Q8. Explain the algorithm? What are five characterstics of an algorithm?
Q9.Draw a flowchart to find highest common factor(H.c.f) of two given
numbers m and n.
Q10. What is flowchart?Explain its symbols by designing a flowchart
for finding whether give number is prime or not?
Q11. Why time complexity is an important issue?Explain.
Q12. How flowchart ,algorithm,program &pseudo codes are different
from each other ?Also enumerate their individual importance and
relevance.Write them all for generating a sine series.

More Related Content

PDF
Programming For Problem Solving Lecture Notes
PPTX
Programming Paradigm & Languages
PPTX
Data structure and algorithm
PDF
Unit 1-problem solving with algorithm
PPTX
Procedural programming
DOCX
PPS 1.1.INTRODUCTION TO COMPONENTS OF A COMPUTER SYSTEM (DISKS, MEMORY, PROCE...
PPT
Problem solving using Computer
PPTX
Computer programming - turbo c environment
Programming For Problem Solving Lecture Notes
Programming Paradigm & Languages
Data structure and algorithm
Unit 1-problem solving with algorithm
Procedural programming
PPS 1.1.INTRODUCTION TO COMPONENTS OF A COMPUTER SYSTEM (DISKS, MEMORY, PROCE...
Problem solving using Computer
Computer programming - turbo c environment

What's hot (20)

PDF
FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM)
PPTX
Preprocessor directives in c language
DOC
Notes of c programming 1st unit BCA I SEM
PPTX
Introduction to problem solving in C
PDF
Python exception handling
PPTX
Looping statements in C
PDF
Semaphores
PPTX
Presentation on-exception-handling
PPTX
Memory Hierarchy
PPTX
Algorithm analysis in fundamentals of data structure
PPTX
Polymorphism in c++(ppt)
PPTX
Exception handling c++
PPTX
Exception handling in c++
PPTX
Stack Operations
PPTX
Functions in Python
PPTX
Inter Process Communication
PPTX
Computer registers
PPTX
Decision making statements in C programming
PPTX
Register & Memory
PPTX
queue & its applications
FUNCTION IN C PROGRAMMING UNIT -6 (BCA I SEM)
Preprocessor directives in c language
Notes of c programming 1st unit BCA I SEM
Introduction to problem solving in C
Python exception handling
Looping statements in C
Semaphores
Presentation on-exception-handling
Memory Hierarchy
Algorithm analysis in fundamentals of data structure
Polymorphism in c++(ppt)
Exception handling c++
Exception handling in c++
Stack Operations
Functions in Python
Inter Process Communication
Computer registers
Decision making statements in C programming
Register & Memory
queue & its applications
Ad

Similar to Problem solving UNIT - 4 [C PROGRAMMING] (BCA I SEM) (20)

PPTX
Introductions to Problem solvings.pptx
PPTX
Unit VI. 6. 6 A PROBLEM SOVING, DEFINITION, STEPS INVOLVED IN PROBLEM SOLVIN...
PPTX
Unit VI. 6. 6 A PROBLEM SOVING, DEFINITION, STEPS INVOLVED IN PROBLEM SOLVIN...
PPTX
Problem solving
PPTX
Teaching thinking and problem solving skills
PPTX
PDF
Problem solving and critical thinking 1
DOCX
Csc 102 lecture note(introduction to problem solving)
PDF
Study Material for Problem Solving Techniques
PPT
problem solving
PPTX
Creative problem solving skills & process
PPTX
Problem solving
PDF
Problem solving methodology
PPTX
23. Methodology of Problem Solving
PPTX
Java Problem solving
PDF
Introduction to Programming
PDF
643214100-CSC-102-INTRODUCTION-TO-PROBLEM-SOLVING-pdf.pdf
PDF
643214100-CSC-102-INTRODUCTION-TO-PROBLEM-SOLVING-pdf.pdf
PDF
643214100-CSC-102-INTRODUCTION-TO-PROBLEM-SOLVING-pdf.pdf
PPT
Creative Problem Solving Skills For Staff
Introductions to Problem solvings.pptx
Unit VI. 6. 6 A PROBLEM SOVING, DEFINITION, STEPS INVOLVED IN PROBLEM SOLVIN...
Unit VI. 6. 6 A PROBLEM SOVING, DEFINITION, STEPS INVOLVED IN PROBLEM SOLVIN...
Problem solving
Teaching thinking and problem solving skills
Problem solving and critical thinking 1
Csc 102 lecture note(introduction to problem solving)
Study Material for Problem Solving Techniques
problem solving
Creative problem solving skills & process
Problem solving
Problem solving methodology
23. Methodology of Problem Solving
Java Problem solving
Introduction to Programming
643214100-CSC-102-INTRODUCTION-TO-PROBLEM-SOLVING-pdf.pdf
643214100-CSC-102-INTRODUCTION-TO-PROBLEM-SOLVING-pdf.pdf
643214100-CSC-102-INTRODUCTION-TO-PROBLEM-SOLVING-pdf.pdf
Creative Problem Solving Skills For Staff
Ad

More from Mansi Tyagi (20)

PPTX
Unit 5 INTERNATIONAL THEORY
PPTX
Unit 2 foreign trade topic 2 3 4 5
PPTX
Unit 2 Foreign trade
PPTX
Unit 1 international trade
PPTX
Unit 1 international trade theory
PPTX
Unit 5 Sales Management
PPTX
Unit 4 Sales Management
PPT
Unit 3 Sales Management
PPTX
Unit 2 Sales Management
PPT
Unit 1 Sales Mgt
DOCX
C Language Programs
PPT
BONUS ACT (HRM)
DOCX
RESEARCH REPORT
DOC
A study of employee motivation
DOC
PROJECT REPORT ON CONSUMER BUYING BEHAVIOUR IN INDIAN SHOPPING MALL)
PPTX
PROJECT ON ANDROID APPLICATION
PPTX
Role of digital marketing
PPT
BUSINESS REPORT WRITING
PPT
Childhood Asthma
PPTX
PROJECT ON EXISTING EMPLOYEE ENGAGEMENT SYSTEM
Unit 5 INTERNATIONAL THEORY
Unit 2 foreign trade topic 2 3 4 5
Unit 2 Foreign trade
Unit 1 international trade
Unit 1 international trade theory
Unit 5 Sales Management
Unit 4 Sales Management
Unit 3 Sales Management
Unit 2 Sales Management
Unit 1 Sales Mgt
C Language Programs
BONUS ACT (HRM)
RESEARCH REPORT
A study of employee motivation
PROJECT REPORT ON CONSUMER BUYING BEHAVIOUR IN INDIAN SHOPPING MALL)
PROJECT ON ANDROID APPLICATION
Role of digital marketing
BUSINESS REPORT WRITING
Childhood Asthma
PROJECT ON EXISTING EMPLOYEE ENGAGEMENT SYSTEM

Recently uploaded (20)

PDF
RMMM.pdf make it easy to upload and study
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Institutional Correction lecture only . . .
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
master seminar digital applications in india
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Computing-Curriculum for Schools in Ghana
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
RMMM.pdf make it easy to upload and study
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Institutional Correction lecture only . . .
O5-L3 Freight Transport Ops (International) V1.pdf
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
master seminar digital applications in india
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
Microbial diseases, their pathogenesis and prophylaxis
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
O7-L3 Supply Chain Operations - ICLT Program
Anesthesia in Laparoscopic Surgery in India
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Microbial disease of the cardiovascular and lymphatic systems
Renaissance Architecture: A Journey from Faith to Humanism
Computing-Curriculum for Schools in Ghana
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student

Problem solving UNIT - 4 [C PROGRAMMING] (BCA I SEM)

  • 1. (UNIT-4 ) PPA Notes by: Mansi Tyagi PPA (UNIT - 5) INTRODUCTION TO Problem Solving In general, in our daily life ,we face a variety of problems that may be related to any field. The same problem can be solved in different way by different person and the techniques used for the solution by someone may be correct.  The nature of the problem depends on the situation.  Problem solving may be an art or science.It includes special knowledge in the fields to which the problem relates to and power of knowledge without learning,human reasoning and experience.  In problem solving each individual may have his or her own unique way. Therefore ,prior to the solution of any problem one should follow the following basic steps that may give a clear and better idea for the solution of any problem: Framework for problem solving: STEP1: Understanding the problem In this step you should try to understand the actual problems by asking the following basic questions:  Can you state the problems in your own words?  What are you trying to find or do?  What are unknowns?
  • 2. (UNIT-4 ) PPA Notes by: Mansi Tyagi STEP2: Devising a Plan/Making a plan of solution Its very useful to prepare a good plan for the solution of given problems:  Look for a pattern  Examine related problems.  Make a table,diagrams & equation if required  Use quess and check STEP3: Carrying out the plan Implement the strategies in step 2 and perform any necessary actions or computations.This may be a formal proof of each step.finally keep an accurate record of your work for further use. STEP4: Looking back/Verifying After successful carrying out the plan,following should be checked:  Check the results in the original problem.  Interpret the solution in terms of the original problem. BRB11 PROBLEM SOLVING TECHNIQUES TRIAL AND ERROR TECHNIQUES BRAIN STORMING TECHNIQUES DIVIDE & CONQUER TECHNIQUES
  • 3. (UNIT-4 ) PPA Notes by: Mansi Tyagi 1. TRIAL AND ERROR TECHNIQUE//METHOD : Some complex problems can be solved by a technique that is called trial and error.Trial and error is typically good for problems where you have multiple chances to get the correct solution.  The purpose of trial and error is not to find out why a problem was solved.its primarily used to solve the problem.  Trial and error is used to find a single solutions to a single problem.  Trial and error is used best when it is applied to situations that give your large amounts of time and safety to come up with a solution. For example :while trial and error may be excellent in finding solutions to mechanical or engineering problems. Advantages :  It does not require you to have a lot of knowledge.  It also plays an important role in the scientific method as well.  Trail and error is also an excellent tool for inventors. 2. BRAIN STORMING TECHNIQUES : “Brainstoring is a group method for obtaining new ideas and business solutions.The groups are organized for sitting together and stimulate
  • 4. (UNIT-4 ) PPA Notes by: Mansi Tyagi greater creativity by exchange of mutual experiences and participating in the discussions.”  Brainstorming can be an effective way to generate lots of ideas on a specific issue and then determine which ideas is the best solution.  It is most effective with groups of 8-12 people and should be performed in a relaxed environment.If participants feel free to relax and joke around,they will stretch their minds further and therefore produce more creative ideas. For example: It is commonly used for advertising,the development of new products,process management and business planning. There are four basic rules in brainstorming : 1. No Criticism : Criticism is reserved for the evaluation stage of the process.This allows the members to feel comfortable with the idea of generating unusual ideas. 2. Welcome unusual ideas :Unusual ideas are welcomed as it is normally easier “tame down” than to “tame up ” as new ways of thinking and looking at the world may provide better solutions. 3. Quantity wanted: The greater the number of ideas generated,the greater the chance of producing an effective solution. 4. Combine and improve ideas: combine ideas in order to make them better. Advantages :  Encouraged creative thinking  All ideas are accepted.
  • 5. (UNIT-4 ) PPA Notes by: Mansi Tyagi  Makes everyone part of team  Easy and simple technique. STEPS OF BRAINSTORMING : 3. DIVIDE AND CONQUER TECHNIQUES : In the technique,the main problem is divided into several smaller sub problems and then it is solved recursively.At last combine these solutions to create the solution of the original problem. Divide and conquer approach normally follow the following steps- Define the problem /Explain the topic Set a time limit Encourage Ideas Records the ideas Clarifying Evaluate ideas Create possible solution
  • 6. (UNIT-4 ) PPA Notes by: Mansi Tyagi  Divide : Divide the original problem into a set of sub problems  Conquer : Solve each sub problem individually and recursively if required.  Combine: Finally, combine the solutions of the sub problems into a solution of the entire original problem. Divide and conquer strategy PROBLEM OF SIZE “n” Subproblem 2 of size n/2Subproblem 1 of size n/2 Solution to Subproblem 1 Solution to Subproblem 2 Solution to the Original Problem
  • 7. (UNIT-4 ) PPA Notes by: Mansi Tyagi Seven Steps to Problem Solving 1.Define & identify the problem: The first step is critical .its essential for each group member to cearly understand the problem so that all energy will be focused in the same direction. 2.Analyze the problem : In this stage of problem solving, questions should be asked and information gathered. Do not make the mistakes of assuming you know what is causing the problem without an effort to fully investigate the problem you have defined. Define and Identify the problem Analyze the problem Identifying possible solutions Selecting the best solutions Evaluate Solutions Develop an Action Plan Implement the Solution
  • 8. (UNIT-4 ) PPA Notes by: Mansi Tyagi 3.Identifying possible solution: Identifying possible solutions to the problem is sometimes referred to as finding “Optional solutions” because the goal is to complete a list of all conceivable alternatives to the problem. 4. Selecting the best solution: Decision making can be seen as bringing one into an ambivalent relationship with both power and responsibility. 5.Evaluating Solutions: There are several ways to evaluate the chosen solution,and writing them all down will help the group to choose the best solution to the problem. 6. Develop an Action Plan: An action plan is a chart that lists the tasks that need to be done and identifies who will be responsible for each,when and what action is necessary ,where to start,and how.  Divide the solution into sequential tasks  Develop the contingency plans. 7.Implement the solution : Showing that the problem solving process organized and orderly process will convince others that the solution is valid.
  • 9. (UNIT-4 ) PPA Notes by: Mansi Tyagi ALGORITHM A algorithm is a procedure or formula for solving a problem.It can defined as a step-by-step procedure to solve a particular problem or program.  An algorithm is a sequence of finite instructions used for calculations and data processing.  It’s a type of effective method in which a lsit of well-defined instructions for completing a task will,when given an initial state,proceed through a well defined series of successive states,eventually terminating in an end-state.  Five Characterstics of Algorithm : 1.Input: It may accept zero or more input. 2.Output: It should produce at least one output. 3.Definiteness:Each instruction must be clear ,well defined and precise.There should not be an ambiguity. 4.Finiteness: It should be a sequence a finite instructions i.e;it should end after a fixed time. 5.Effectiveness: Steps are sufficiently simple and basic.  Notations for algorithm: 1.Name of the algorithm 2.Step numbers 3.Explanatory comment 4.Termination
  • 10. (UNIT-4 ) PPA Notes by: Mansi Tyagi  Essential properties of an algorithm :  It must be concise  It must be unambiguous  It must be simple  It should lead to a unique solution of the problem  It must be capable of machine execution  Advantages :  Easy to debug  It is independent of programming languages.  It has a definite procedure.  Disadvantages:  It is cumbersome and time consuming  Example 1: Write an algorithm to determine a student’s final grade and indicate whether it is passing or failing. The final grade is calculated as the average of four marks. Step 1: Start Step 2: Input M1,M2,M3,M4 Step 3: GRADE  (M1+M2+M3+M4)/4 Step 4: if (GRADE < 50) then Print “FAIL” else Print “PASS” Step 5: Stop
  • 11. (UNIT-4 ) PPA Notes by: Mansi Tyagi  Example 2: Write an algorithm that reads three numbers and prints the value of the largest number. Step 1: Start Step 2: Input N1, N2, N3 Step 3: if (N1>N2) then if (N1>N3) then [N1>N2, N1>N3] else [N3>N1>N2] endif else if (N2>N3) then [N2>N1, N2>N3] else [N3>N2>N1] endif endif Step 4: Print “The largest number is”, MAX Step 5 : Stop
  • 12. (UNIT-4 ) PPA Notes by: Mansi Tyagi  Example 3:To print pascal triangle (Important algo.) Step1:START Step2:Read n Step3: For i=1 to n in steps of 1 Begin For i=1 to (n-i)in steps of 1 Begin Print “ “ I=i+1 End For k=1 to (k<i)in steps of 1 Begin Print k K=k+1 End For k=i to 1 in steps of 1 Begin Print k K=k-1 End Print from new line i=i+1 End Step4: STOP
  • 13. (UNIT-4 ) PPA Notes by: Mansi Tyagi Pseudo Code: is an artificial and informal language that helps programmers develop algorithms. Pseudo code is very similar to everyday English.  Example 1: Write an algorithm to determine a student’s final grade and indicate whether it is passing or failing. The final grade is calculated as the average of four marks. Pseudo code:  Input a set of 4 marks  Calculate their average by summing and dividing by 4  if average is below 50 Print “FAIL” else Print “PASS”
  • 14. (UNIT-4 ) PPA Notes by: Mansi Tyagi Flowchart A Flowchart  shows logic of an algorithm  emphasizes individual steps and their interconnections  e.g. control flow from one action to the next  Flow chart is diagrammatic representation of an algorithm. It is built using different types of boxes of symbols. The operation to be performed is written in the box. All symbols are interconnected by arrows to indicate the flow of information and processing. Following are the standard symbols used in drawing flowcharts. Oval Terminal Start/stop/begin/end symbol Parallelogram Input/Output Making data available for processing (input) or recording of the processed information(output) Rectangle Process Any processing to be performed. An assignment operation normally represented by this symbol Diamond Decision Decisionorswitchingtype of operations that determines which of the
  • 15. (UNIT-4 ) PPA Notes by: Mansi Tyagi alternative paths is to be followed. Circle Connecter Used for connecting different parts of flow chart. Arrow Flow Joins two symbols and also represents executions flow.  `Advantages:  Communication: flowcharts are better way of communicating the logic of a system to all concerned.  Effective analysis: with the help of flowchart problem can be analyzed in more effective way.  Proper documentation  Efficient coding  Proper debugging  Efficient program maintenance  Disadvantages:  Complex logic  Alternativess and modifications  Reproductions  Time-consuming  Subjective
  • 16. (UNIT-4 ) PPA Notes by: Mansi Tyagi  Example :Draw a flowchart that will read the two sides of a rectangle and calculate its area. Complexity It is very convenient to classify algorithms based on the relative amount of time or relative amount of space they require and specify the growth of time/space requirements as a function of the input size. TYPES OF COMPLEXITY ARE: 1.SPACE COMPLEXITY 2. TIME COMPLEXITY
  • 17. (UNIT-4 ) PPA Notes by: Mansi Tyagi 1. Space complexity: Space complexity of an algorithm is the amount of memory it needs to run to completion. S(x)= c+Sx S(x) is the space required by a problem x C is a constant Sx is an instance characterstic 2.Time Complexity : Time complexity of an algorithm signifies the total time required by the program to run to completion. The time complexity of algorithms is most commonly expressed using the big O notation. Time Complexity is most commonly estimated by counting the number of elementary functions performed by the algorithm. And since the algorithm's performance may vary with different types of input data, hence for an algorithm we usually use the worst-case Time complexity of an algorithm because that is the maximum time taken for any input size. Some of the reasons for studying time complexity are:  We may be interested to know in advance that whether an algorithm/program will provide a satisfactory real time response.  There may be several possible solutions with different time requirements.
  • 18. (UNIT-4 ) PPA Notes by: Mansi Tyagi Types of Notations for Time Complexity Now we will discuss and Big Oh denotes "fewer than or the same as" <expression> iterations. 1. Big Omega denotes "more than or the same as" <expression> iterations. 2. Big Theta denotes "the same as" <expression> iterations. 3. Little Oh denotes "fewer than" <expression> iterations. 4. Little Omega denotes "more than" <expression> iterations. Understanding Notations of Time Complexity with Example  O (expression) is the set of functions that grow slower than or at the same rate as expression.  Omega (expression) is the set of functions that grow faster than or at the same rate as expression.  Theta (expression) consist of all the functions that lie in both O(expression) and Omega expression.
  • 19. (UNIT-4 ) PPA Notes by: Mansi Tyagi Big Oh Notation Big-oh notation is the formal method of expressing the upper bound of an algorithm’s running time. It is the measure of the longest amount of time it could possibly take for the algorithm to complete. We have O(f) called big-oh,which represents the class of functions that grow no faster than f. It is used in computer science to describe the performance or complexity of an algorithm. Use of Big Oh Notation Big oh notaion has two main areas of application:  In computer science, big oh notation is used to classify algorithms by how they respond to changes in input size.  In mathematics, big oh notation is used to describe the limiting behaviour of a unction when the argument tends towards a particular value or infinity, usually in terms of simpler functions.  It is also used in many other fields to provide similar estimates.
  • 20. (UNIT-4 ) PPA Notes by: Mansi Tyagi IMPORTANT QUESTIONS Q1. Describe the relevance and importance of problem solving techniques. Q2. What do you understand bythe pseudocode? Q3. What is divide and conquer techniques to solve a problem?Explain it by giving an example. Q4. Write the short note on brainstorming? Q5. Discuss the different techniques for problem solving with help of examples? Q6. Explain various steps involved in problem solving? Q7. What is big-oh notation? Explain its use. Q8. Explain the algorithm? What are five characterstics of an algorithm? Q9.Draw a flowchart to find highest common factor(H.c.f) of two given numbers m and n. Q10. What is flowchart?Explain its symbols by designing a flowchart for finding whether give number is prime or not? Q11. Why time complexity is an important issue?Explain. Q12. How flowchart ,algorithm,program &pseudo codes are different from each other ?Also enumerate their individual importance and relevance.Write them all for generating a sine series.