SlideShare a Scribd company logo
1 of 20
(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

What's hot

Our presentation on algorithm design
Our presentation on algorithm designOur presentation on algorithm design
Our presentation on algorithm design
Nahid Hasan
 
Time and space complexity
Time and space complexityTime and space complexity
Time and space complexity
Ankit Katiyar
 

What's hot (20)

Programming languages
Programming languagesProgramming languages
Programming languages
 
Recursion in C++
Recursion in C++Recursion in C++
Recursion in C++
 
Compiler Construction introduction
Compiler Construction introductionCompiler Construction introduction
Compiler Construction introduction
 
Our presentation on algorithm design
Our presentation on algorithm designOur presentation on algorithm design
Our presentation on algorithm design
 
System calls
System callsSystem calls
System calls
 
sum of subset problem using Backtracking
sum of subset problem using Backtrackingsum of subset problem using Backtracking
sum of subset problem using Backtracking
 
LISP: Introduction to lisp
LISP: Introduction to lispLISP: Introduction to lisp
LISP: Introduction to lisp
 
Problem solving using Computer
Problem solving using ComputerProblem solving using Computer
Problem solving using Computer
 
Introduction to problem solving in C
Introduction to problem solving in CIntroduction to problem solving in C
Introduction to problem solving in C
 
Problem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to CProblem Solving Techniques and Introduction to C
Problem Solving Techniques and Introduction to C
 
Introduction to Dynamic Programming, Principle of Optimality
Introduction to Dynamic Programming, Principle of OptimalityIntroduction to Dynamic Programming, Principle of Optimality
Introduction to Dynamic Programming, Principle of Optimality
 
Sorting
SortingSorting
Sorting
 
3.5 merge sort
3.5 merge sort3.5 merge sort
3.5 merge sort
 
Lecture 2 role of algorithms in computing
Lecture 2   role of algorithms in computingLecture 2   role of algorithms in computing
Lecture 2 role of algorithms in computing
 
Time space trade off
Time space trade offTime space trade off
Time space trade off
 
Csc 102 lecture note(introduction to problem solving)
Csc 102 lecture note(introduction to problem solving)Csc 102 lecture note(introduction to problem solving)
Csc 102 lecture note(introduction to problem solving)
 
Graph coloring using backtracking
Graph coloring using backtrackingGraph coloring using backtracking
Graph coloring using backtracking
 
Time and space complexity
Time and space complexityTime and space complexity
Time and space complexity
 
Divide and conquer
Divide and conquerDivide and conquer
Divide and conquer
 
Dijkstra's Algorithm
Dijkstra's Algorithm Dijkstra's Algorithm
Dijkstra's Algorithm
 

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

QM-021-PDCA
QM-021-PDCAQM-021-PDCA
QM-021-PDCA
handbook
 
Group problem solving by mihaela-alexandrina cenusa
Group problem solving by mihaela-alexandrina cenusaGroup problem solving by mihaela-alexandrina cenusa
Group problem solving by mihaela-alexandrina cenusa
budur eleonora
 
Sujit sopan barhate
Sujit sopan barhateSujit sopan barhate
Sujit sopan barhate
PMI2011
 
Sujit 20sopan-20barhate-131008015800-phpapp02
Sujit 20sopan-20barhate-131008015800-phpapp02Sujit 20sopan-20barhate-131008015800-phpapp02
Sujit 20sopan-20barhate-131008015800-phpapp02
PMI_IREP_TP
 
8D Problem Solving WorksheetGroup NumberGroup Member Nam.docx
8D Problem Solving WorksheetGroup NumberGroup Member Nam.docx8D Problem Solving WorksheetGroup NumberGroup Member Nam.docx
8D Problem Solving WorksheetGroup NumberGroup Member Nam.docx
ransayo
 
Chapter 5 successful problem solving & task mgt
Chapter 5   successful problem solving & task mgtChapter 5   successful problem solving & task mgt
Chapter 5 successful problem solving & task mgt
Nasz Zainuddin
 

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

Decision making & problem solving
Decision making & problem solvingDecision making & problem solving
Decision making & problem solving
 
QM-021-PDCA
QM-021-PDCAQM-021-PDCA
QM-021-PDCA
 
PDCA
PDCAPDCA
PDCA
 
Problem-Solving-Techniques-2015.pptx
Problem-Solving-Techniques-2015.pptxProblem-Solving-Techniques-2015.pptx
Problem-Solving-Techniques-2015.pptx
 
Tool & techniques decision making process
Tool & techniques decision making processTool & techniques decision making process
Tool & techniques decision making process
 
Viima - The Complete Toolkit to Idea Challenges
Viima - The Complete Toolkit to Idea ChallengesViima - The Complete Toolkit to Idea Challenges
Viima - The Complete Toolkit to Idea Challenges
 
Group problem solving by mihaela-alexandrina cenusa
Group problem solving by mihaela-alexandrina cenusaGroup problem solving by mihaela-alexandrina cenusa
Group problem solving by mihaela-alexandrina cenusa
 
How to Make a Good Idea Great
How to Make a Good Idea GreatHow to Make a Good Idea Great
How to Make a Good Idea Great
 
Cognitive and meta cognitive strategies for problem solving in Mathematics
Cognitive and meta cognitive strategies for problem solving in MathematicsCognitive and meta cognitive strategies for problem solving in Mathematics
Cognitive and meta cognitive strategies for problem solving in Mathematics
 
Problem solving technique , strategies
Problem solving technique , strategiesProblem solving technique , strategies
Problem solving technique , strategies
 
Mentoring
MentoringMentoring
Mentoring
 
Sujit sopan barhate
Sujit sopan barhateSujit sopan barhate
Sujit sopan barhate
 
Sujit 20sopan-20barhate-131008015800-phpapp02
Sujit 20sopan-20barhate-131008015800-phpapp02Sujit 20sopan-20barhate-131008015800-phpapp02
Sujit 20sopan-20barhate-131008015800-phpapp02
 
Critical writing and presentation skills
Critical writing and presentation skillsCritical writing and presentation skills
Critical writing and presentation skills
 
assist clients with Policy development to.docx
assist clients with Policy development to.docxassist clients with Policy development to.docx
assist clients with Policy development to.docx
 
LESSON PLAN-Project -Durrell Gemuh Abwoengmo.pptx.pdf
LESSON PLAN-Project -Durrell Gemuh Abwoengmo.pptx.pdfLESSON PLAN-Project -Durrell Gemuh Abwoengmo.pptx.pdf
LESSON PLAN-Project -Durrell Gemuh Abwoengmo.pptx.pdf
 
Polya
PolyaPolya
Polya
 
8D Problem Solving WorksheetGroup NumberGroup Member Nam.docx
8D Problem Solving WorksheetGroup NumberGroup Member Nam.docx8D Problem Solving WorksheetGroup NumberGroup Member Nam.docx
8D Problem Solving WorksheetGroup NumberGroup Member Nam.docx
 
Chapter 5 successful problem solving & task mgt
Chapter 5   successful problem solving & task mgtChapter 5   successful problem solving & task mgt
Chapter 5 successful problem solving & task mgt
 
Design Sprints
Design SprintsDesign Sprints
Design Sprints
 

More from Mansi Tyagi

More from Mansi Tyagi (20)

Unit 5 INTERNATIONAL THEORY
Unit 5 INTERNATIONAL THEORYUnit 5 INTERNATIONAL THEORY
Unit 5 INTERNATIONAL THEORY
 
Unit 2 foreign trade topic 2 3 4 5
Unit 2 foreign trade topic 2 3 4 5Unit 2 foreign trade topic 2 3 4 5
Unit 2 foreign trade topic 2 3 4 5
 
Unit 2 Foreign trade
Unit 2 Foreign tradeUnit 2 Foreign trade
Unit 2 Foreign trade
 
Unit 1 international trade
Unit 1 international tradeUnit 1 international trade
Unit 1 international trade
 
Unit 1 international trade theory
Unit 1 international trade theoryUnit 1 international trade theory
Unit 1 international trade theory
 
Unit 5 Sales Management
Unit 5 Sales ManagementUnit 5 Sales Management
Unit 5 Sales Management
 
Unit 4 Sales Management
Unit 4 Sales ManagementUnit 4 Sales Management
Unit 4 Sales Management
 
Unit 3 Sales Management
Unit 3 Sales ManagementUnit 3 Sales Management
Unit 3 Sales Management
 
Unit 2 Sales Management
Unit 2 Sales ManagementUnit 2 Sales Management
Unit 2 Sales Management
 
Unit 1 Sales Mgt
Unit  1 Sales Mgt Unit  1 Sales Mgt
Unit 1 Sales Mgt
 
C Language Programs
C Language Programs C Language Programs
C Language Programs
 
BONUS ACT (HRM)
BONUS ACT (HRM)BONUS ACT (HRM)
BONUS ACT (HRM)
 
RESEARCH REPORT
RESEARCH REPORT RESEARCH REPORT
RESEARCH REPORT
 
A study of employee motivation
A study of employee motivationA study of employee motivation
A study of employee motivation
 
PROJECT REPORT ON CONSUMER BUYING BEHAVIOUR IN INDIAN SHOPPING MALL)
PROJECT REPORT ON  CONSUMER BUYING BEHAVIOUR IN INDIAN SHOPPING MALL) PROJECT REPORT ON  CONSUMER BUYING BEHAVIOUR IN INDIAN SHOPPING MALL)
PROJECT REPORT ON CONSUMER BUYING BEHAVIOUR IN INDIAN SHOPPING MALL)
 
Notes of c programming 1st unit BCA I SEM
Notes of c programming  1st unit BCA I SEMNotes of c programming  1st unit BCA I SEM
Notes of c programming 1st unit BCA I SEM
 
PROJECT ON ANDROID APPLICATION
PROJECT ON ANDROID APPLICATIONPROJECT ON ANDROID APPLICATION
PROJECT ON ANDROID APPLICATION
 
Role of digital marketing
Role of digital marketingRole of digital marketing
Role of digital marketing
 
BUSINESS REPORT WRITING
BUSINESS REPORT WRITINGBUSINESS REPORT WRITING
BUSINESS REPORT WRITING
 
Childhood Asthma
Childhood AsthmaChildhood Asthma
Childhood Asthma
 

Recently uploaded

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 

Recently uploaded (20)

Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 

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.