SlideShare ist ein Scribd-Unternehmen logo
1 von 67
Dr. Jeetashree Aparajeeta
Assistant Professor (Sr)
SENSE
 Introduction to Problem Solving
◦ Problem Solving: Definition and Steps
◦ Problem Analysis Chart
◦ Developing an Algorithm
◦ Flowchart
◦ Pseudocode
2
 Use of computer technology help in completing any
task in a much faster and accurate manner.
 Ex. Paying electric bill, booking a health check up,
ordering your favorite food, booking movie tickets
etc.
 These technologies follow a proper problem
solving approach for an essential skill to solve the
related problems.
 Ex. You cannot order food using Apollo247 App.
3
 The standard computers, that we use, are not
advance enough to solve a problem of their own,
so we need to feed step-by-step instructions to
the computer to solve any problem.
 The efficiency in solving the problem depends
upon how correctly and precisely we define the
problem, design a solution (algorithm) and
implement the solution (program) using a
programming language.
4
 So, the problem solving can be defined as the
process of identifying a problem, developing an
algorithm for the identified problem and finally
implementing the algorithm to develop a
computer program.
5
 The correctness of the output that a computer gives
depends upon the correctness of input provided.
 Key steps required for solving a problem
I. Analyzing the problem
II. Developing an algorithm
a. Flowchart
b. Pseudocode
III. Coding
IV. Testing and Debugging
6
Analysing the problem
It is important to clearly understand a problem before
we begin to find the solution for it. If we are not clear
as to what is to be solved, we may end up developing
a program which may not solve our purpose. Thus,
we need to read and analyse the problem statement
carefully in order to list the principal components of
the problem and decide the core functionalities that
our solution should have. By analysing a problem, we
would be able to figure out what are the inputs that
our program should accept and the outputs that it
should produce
4.2.1 Analysing the problem
It is important to clearly understand a problem before
we begin to find the solution for it. If we are not clear
as to what is to be solved, we may end up developing
a program which may not solve our purpose. Thus,
we need to read and analyse the problem statement
carefully in order to list the principal components of
the problem and decide the core functionalities that
our solution should have. By analysing a problem, we
would be able to figure out what are the inputs that
our program should accept and the outputs that it
should produce.
4.2.2 Developing an Algorithm
It is essential to device a solution before writing a
program code for a given problem. The solution is
represented in natural language and is called an
algorithm. We can imagine an algorithm like a very
well-written recipe for dish.
We start with a tentative solution plan and keep
on refining the algorithm until the algorithm is able
to capture all the aspects of the desired solution. For
a given problem, more than one algorithm is possible
and we have to select the most suitable solution
 4.2.3 Coding
 After finalising the algorithm, we need to
convert the algorithm into the format which
can be understood by the computer to
generate the desired solution. Different
 high level programming languages can be
used for writing a program
4.2.4 Testing and Debugging
The program created should be tested on
various parameters. The program should meet
the requirements of the user. It must respond
within the expected time. It should generate
correct output for all possible inputs. In the
presence of syntactical errors, no output will
be obtained. In case the output generated is
incorrect, then the program should be checked
for logical errors, if any.
33
Separate the problem into
three components
Input
A list of data source
Provided to the problem
Output
A list of the output
required
Processing
A list of actions needed
to produce the required
outputs.
 PAC is used to analyze a problem.
 It has four sections:
a. The given data
b. The required result
c. The processing involved
d. A list of solution alternative
34
Given Data Required result
Section 1
Data given in the
problem/ provided by the
user
Section 2
Requirements for the
output reports including
the information needed
and the format required
Processing Required Solution Alternative
Section 3
List of processing
required including
equations or other types
of processing.
Section 4
List of ideas for the
solution of the problem
35
 Problem:
 A program is required to find average of five
numbers.
36
37
Given Data Required result
Number 1
Number 2
Number 3
Number 4
Number 5
Average of 5 numbers
Processing Required Solution Alternative
Total = Number 1 +
Number 2 + Number 3 +
Number 4 + Number 5
Average = Total / 5
i. Define the numbers as
constants
ii. Define the numbers as
input values
 Total = 5 + 6 + 8 + 9 + 11
Or
 Number 1 = 5, Number 2 = 6, Number 3 = 8,
Number 4 = 9, Number 5 = 11
Or
 Number = “Ask the user to provide the
number”
38
 Calculate the gross pay of an employee. The
formula to be used : GrossPay = Hours x
Payrate
39
40
Given Data Required result
Hours
PayRate
Gross Pay
Processing Required Solution Alternative
GrossPay = Hours * PayRate 1. Define the hours worked and
Payrate as constant
2. Define the hours worked and
PayRate as input
 Convert the distance in KM to miles where 1
mile = 1.609 km
41
42
Given Data Required result
Distance in km Distance in mile
Processing Required Solution Alternative
Mile = km/1.609 1. Define the km as constant
2. Define the km as input
 An algorithm is an effective method expressed as
a finite list of well defined instructions for
calculating a function, starting from an initial
state and initial input.
 The instructions describe a computation, which
will eventually produce output, when executed.
 Algorithm can be used to solve any kind of
problems.
 However, before writing a program, we need to
write the steps to solve the problem in simple
English language. This step-by-step procedure
to solve the problem is called algorithm.
43
 The way of execution of program is
categorized as
◦ Sequence Statements
◦ Selection Statements
◦ Iteration or Looping Statements (Called Control
Structure)
44
 In this program, all the instructions are
executed one after another.
 Ex: Algorithm to find the area of a rectangle
◦ Step 1: Start
◦ Step 2: Take length and breadth and store them as
L and B
◦ Step 3: Multiply by L and B and store it in Area
◦ Step 4: Print Area
◦ Step 5: Stop
45
 In this type of programming, some portion of
the program is executed based upon the
conditional test.
 If the conditional test is true, compiler will
execute some part of the program, otherwise
it will execute the other part of the program.
46
 Ex: Algorithm to check whether a candidate is
eligible to vote?
◦ Step 1: Start
◦ Step 2: Take age and store it in Age
◦ Step 3: Check Age value, if age > 18, then go to
step-4 else Step-5
◦ Step 4: Print “Eligible to Vote” and go to Step-6
◦ Step 5: Print “Not Eligible to Vote”
◦ Step 6: Stop
47
 Two common methods are used to represent
an algorithm
a. Flowchart
b. Pseudocode
 Either of the methods can be used to represent
an algorithm.
48
 The flowchart and pseudocode showcases the
logic of the solution required to solve the
problem excluding any implementation details.
 We can understand the flow of control during
execution of the program.
49
 Visual representation of an algorithm
 It is a diagram made up of boxes, diamonds
and other shapes, connected by arrows.
 Each shape represents a step of the solution
process and the arrow represents the order or
link among the steps.
50
A flow chart is an
organized
combination of shapes,
lines and text that
graphically illustrate a
process or structure.
51
 Write an algorithm to find the square of a
number
52
 Before developing the algorithm, first identify
the input, process and output.
◦ Input: Number whose square is required
◦ Process: Multiply the number by itself to get its
square
◦ Output: Square of the number
53
 Step 1: Input a number and stored it to Number
(Number is a variable)
 Step 2: Compute Number * Number and store it
in Square (Square is a variable)
 Step 3: Print Square
54
55
56
 Pseudocode is another way of representing an algorithm.
 It is a kind of structured English for describing algorithms
 It allows the designer to focus on the logic of the algorithm
without being distracted by details of language syntax
 Pseudocode needs to be complete
 It describe the entire logic of the algorithm so that
implementation becomes a rote mechanical task of
translating line by line into source code
57
 Each instruction is written on a separate line
 Keywords and indentation are used to signify
particular control structures
 Each set of instructions is written from top to
bottom, with only one entry and one exit
 Groups of statements may be formed into modules,
and that group given a name.
58
 Several keywords are often used to indicate
common input, output, and processing
operations
 Input: READ, OBTAIN, GET
 Output: PRINT, DISPLAY, SHOW
 Compute: COMPUTE, CALCULATE, DETERMINE
 Initialize: SET, INIT
 Add one: INCREMENT, BUMP, DECREMENT
59
 Area of Rectangle.
60
 READ height of Rectangle
 READ width of Rectangle
 COMPUTE area as height times width
 PRINT area of rectangle
61
 Format
IF Condition THEN
Statements
ELSE
Statement
ENDIF
 Example
IF Hours_Worked > Normal_Max THEN
Display overtime message
ELSE
Display regular time message
ENDIF
63
 Format
WHILE Condition
Statements
ENDWHILE
 Example
WHILE Population < Limit
Compute Population as Population + Births ‐ Deaths
ENDWHILE
64
 Format
FOR Iteration Bounds
Statements
ENDFOR
 Example
FOR each student in the list
Print Register_Number
ENDFOR
65
67

Weitere ähnliche Inhalte

Ähnlich wie Introduction to Problem Solving Techniques

L1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdfL1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdfMMRF2
 
01 Introduction to analysis of Algorithms.pptx
01 Introduction to analysis of Algorithms.pptx01 Introduction to analysis of Algorithms.pptx
01 Introduction to analysis of Algorithms.pptxssuser586772
 
Algorithms notes 2 tutorials duniya
Algorithms notes 2   tutorials duniyaAlgorithms notes 2   tutorials duniya
Algorithms notes 2 tutorials duniyaTutorialsDuniya.com
 
C programming for Computing Techniques
C programming for Computing TechniquesC programming for Computing Techniques
C programming for Computing TechniquesAppili Vamsi Krishna
 
Programming_Lecture_1.pptx
Programming_Lecture_1.pptxProgramming_Lecture_1.pptx
Programming_Lecture_1.pptxshoaibkhan716300
 
Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithmrajkumar1631010038
 
Ch1 principles of software development
Ch1 principles of software developmentCh1 principles of software development
Ch1 principles of software developmentHattori Sidek
 
Software develop....
Software develop.... Software develop....
Software develop.... GCWUS
 
Program concep sequential statements
Program concep sequential statementsProgram concep sequential statements
Program concep sequential statementsankurkhanna
 
Algorithmic problem sloving
Algorithmic problem slovingAlgorithmic problem sloving
Algorithmic problem slovingMani Kandan
 
AOA Week 01.ppt
AOA Week 01.pptAOA Week 01.ppt
AOA Week 01.pptINAM352782
 
Logic Development and Algorithm.
Logic Development and Algorithm.Logic Development and Algorithm.
Logic Development and Algorithm.NandiniSidana
 
What is algorithm
What is algorithmWhat is algorithm
What is algorithmmshoaib15
 
PCCF UNIT - 1 - M.Sudharsan.pptx
PCCF UNIT - 1 - M.Sudharsan.pptxPCCF UNIT - 1 - M.Sudharsan.pptx
PCCF UNIT - 1 - M.Sudharsan.pptxsudharsanm56
 
FIT-Unit3 chapter 1 -computer program
FIT-Unit3 chapter 1 -computer programFIT-Unit3 chapter 1 -computer program
FIT-Unit3 chapter 1 -computer programraksharao
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchartSachin Goyani
 

Ähnlich wie Introduction to Problem Solving Techniques (20)

L1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdfL1. Basic Programming Concepts.pdf
L1. Basic Programming Concepts.pdf
 
Practical 01 (detailed)
Practical 01 (detailed)Practical 01 (detailed)
Practical 01 (detailed)
 
01 Introduction to analysis of Algorithms.pptx
01 Introduction to analysis of Algorithms.pptx01 Introduction to analysis of Algorithms.pptx
01 Introduction to analysis of Algorithms.pptx
 
Algorithms notes 2 tutorials duniya
Algorithms notes 2   tutorials duniyaAlgorithms notes 2   tutorials duniya
Algorithms notes 2 tutorials duniya
 
C programming for Computing Techniques
C programming for Computing TechniquesC programming for Computing Techniques
C programming for Computing Techniques
 
Programming_Lecture_1.pptx
Programming_Lecture_1.pptxProgramming_Lecture_1.pptx
Programming_Lecture_1.pptx
 
Unit 1-problem solving with algorithm
Unit 1-problem solving with algorithmUnit 1-problem solving with algorithm
Unit 1-problem solving with algorithm
 
C++ good tutorial
C++ good tutorialC++ good tutorial
C++ good tutorial
 
Ch1 principles of software development
Ch1 principles of software developmentCh1 principles of software development
Ch1 principles of software development
 
Software develop....
Software develop.... Software develop....
Software develop....
 
Program concep sequential statements
Program concep sequential statementsProgram concep sequential statements
Program concep sequential statements
 
Algorithmic problem sloving
Algorithmic problem slovingAlgorithmic problem sloving
Algorithmic problem sloving
 
Software Development
Software DevelopmentSoftware Development
Software Development
 
AOA Week 01.ppt
AOA Week 01.pptAOA Week 01.ppt
AOA Week 01.ppt
 
Logic Development and Algorithm.
Logic Development and Algorithm.Logic Development and Algorithm.
Logic Development and Algorithm.
 
What is algorithm
What is algorithmWhat is algorithm
What is algorithm
 
PCCF UNIT - 1 - M.Sudharsan.pptx
PCCF UNIT - 1 - M.Sudharsan.pptxPCCF UNIT - 1 - M.Sudharsan.pptx
PCCF UNIT - 1 - M.Sudharsan.pptx
 
UNIT-2-PPTS-DAA.ppt
UNIT-2-PPTS-DAA.pptUNIT-2-PPTS-DAA.ppt
UNIT-2-PPTS-DAA.ppt
 
FIT-Unit3 chapter 1 -computer program
FIT-Unit3 chapter 1 -computer programFIT-Unit3 chapter 1 -computer program
FIT-Unit3 chapter 1 -computer program
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
 

Kürzlich hochgeladen

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
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 . pdfQucHHunhnh
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
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.pptxheathfieldcps1
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
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.pdfJayanti Pande
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 

Kürzlich hochgeladen (20)

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
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
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
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
 
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
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
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
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 

Introduction to Problem Solving Techniques

  • 1. Dr. Jeetashree Aparajeeta Assistant Professor (Sr) SENSE
  • 2.  Introduction to Problem Solving ◦ Problem Solving: Definition and Steps ◦ Problem Analysis Chart ◦ Developing an Algorithm ◦ Flowchart ◦ Pseudocode 2
  • 3.  Use of computer technology help in completing any task in a much faster and accurate manner.  Ex. Paying electric bill, booking a health check up, ordering your favorite food, booking movie tickets etc.  These technologies follow a proper problem solving approach for an essential skill to solve the related problems.  Ex. You cannot order food using Apollo247 App. 3
  • 4.  The standard computers, that we use, are not advance enough to solve a problem of their own, so we need to feed step-by-step instructions to the computer to solve any problem.  The efficiency in solving the problem depends upon how correctly and precisely we define the problem, design a solution (algorithm) and implement the solution (program) using a programming language. 4
  • 5.  So, the problem solving can be defined as the process of identifying a problem, developing an algorithm for the identified problem and finally implementing the algorithm to develop a computer program. 5
  • 6.  The correctness of the output that a computer gives depends upon the correctness of input provided.  Key steps required for solving a problem I. Analyzing the problem II. Developing an algorithm a. Flowchart b. Pseudocode III. Coding IV. Testing and Debugging 6
  • 7.
  • 8. Analysing the problem It is important to clearly understand a problem before we begin to find the solution for it. If we are not clear as to what is to be solved, we may end up developing a program which may not solve our purpose. Thus, we need to read and analyse the problem statement carefully in order to list the principal components of the problem and decide the core functionalities that our solution should have. By analysing a problem, we would be able to figure out what are the inputs that our program should accept and the outputs that it should produce
  • 9. 4.2.1 Analysing the problem It is important to clearly understand a problem before we begin to find the solution for it. If we are not clear as to what is to be solved, we may end up developing a program which may not solve our purpose. Thus, we need to read and analyse the problem statement carefully in order to list the principal components of the problem and decide the core functionalities that our solution should have. By analysing a problem, we would be able to figure out what are the inputs that our program should accept and the outputs that it should produce.
  • 10. 4.2.2 Developing an Algorithm It is essential to device a solution before writing a program code for a given problem. The solution is represented in natural language and is called an algorithm. We can imagine an algorithm like a very well-written recipe for dish. We start with a tentative solution plan and keep on refining the algorithm until the algorithm is able to capture all the aspects of the desired solution. For a given problem, more than one algorithm is possible and we have to select the most suitable solution
  • 11.  4.2.3 Coding  After finalising the algorithm, we need to convert the algorithm into the format which can be understood by the computer to generate the desired solution. Different  high level programming languages can be used for writing a program
  • 12. 4.2.4 Testing and Debugging The program created should be tested on various parameters. The program should meet the requirements of the user. It must respond within the expected time. It should generate correct output for all possible inputs. In the presence of syntactical errors, no output will be obtained. In case the output generated is incorrect, then the program should be checked for logical errors, if any.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33. 33 Separate the problem into three components Input A list of data source Provided to the problem Output A list of the output required Processing A list of actions needed to produce the required outputs.
  • 34.  PAC is used to analyze a problem.  It has four sections: a. The given data b. The required result c. The processing involved d. A list of solution alternative 34
  • 35. Given Data Required result Section 1 Data given in the problem/ provided by the user Section 2 Requirements for the output reports including the information needed and the format required Processing Required Solution Alternative Section 3 List of processing required including equations or other types of processing. Section 4 List of ideas for the solution of the problem 35
  • 36.  Problem:  A program is required to find average of five numbers. 36
  • 37. 37 Given Data Required result Number 1 Number 2 Number 3 Number 4 Number 5 Average of 5 numbers Processing Required Solution Alternative Total = Number 1 + Number 2 + Number 3 + Number 4 + Number 5 Average = Total / 5 i. Define the numbers as constants ii. Define the numbers as input values
  • 38.  Total = 5 + 6 + 8 + 9 + 11 Or  Number 1 = 5, Number 2 = 6, Number 3 = 8, Number 4 = 9, Number 5 = 11 Or  Number = “Ask the user to provide the number” 38
  • 39.  Calculate the gross pay of an employee. The formula to be used : GrossPay = Hours x Payrate 39
  • 40. 40 Given Data Required result Hours PayRate Gross Pay Processing Required Solution Alternative GrossPay = Hours * PayRate 1. Define the hours worked and Payrate as constant 2. Define the hours worked and PayRate as input
  • 41.  Convert the distance in KM to miles where 1 mile = 1.609 km 41
  • 42. 42 Given Data Required result Distance in km Distance in mile Processing Required Solution Alternative Mile = km/1.609 1. Define the km as constant 2. Define the km as input
  • 43.  An algorithm is an effective method expressed as a finite list of well defined instructions for calculating a function, starting from an initial state and initial input.  The instructions describe a computation, which will eventually produce output, when executed.  Algorithm can be used to solve any kind of problems.  However, before writing a program, we need to write the steps to solve the problem in simple English language. This step-by-step procedure to solve the problem is called algorithm. 43
  • 44.  The way of execution of program is categorized as ◦ Sequence Statements ◦ Selection Statements ◦ Iteration or Looping Statements (Called Control Structure) 44
  • 45.  In this program, all the instructions are executed one after another.  Ex: Algorithm to find the area of a rectangle ◦ Step 1: Start ◦ Step 2: Take length and breadth and store them as L and B ◦ Step 3: Multiply by L and B and store it in Area ◦ Step 4: Print Area ◦ Step 5: Stop 45
  • 46.  In this type of programming, some portion of the program is executed based upon the conditional test.  If the conditional test is true, compiler will execute some part of the program, otherwise it will execute the other part of the program. 46
  • 47.  Ex: Algorithm to check whether a candidate is eligible to vote? ◦ Step 1: Start ◦ Step 2: Take age and store it in Age ◦ Step 3: Check Age value, if age > 18, then go to step-4 else Step-5 ◦ Step 4: Print “Eligible to Vote” and go to Step-6 ◦ Step 5: Print “Not Eligible to Vote” ◦ Step 6: Stop 47
  • 48.  Two common methods are used to represent an algorithm a. Flowchart b. Pseudocode  Either of the methods can be used to represent an algorithm. 48
  • 49.  The flowchart and pseudocode showcases the logic of the solution required to solve the problem excluding any implementation details.  We can understand the flow of control during execution of the program. 49
  • 50.  Visual representation of an algorithm  It is a diagram made up of boxes, diamonds and other shapes, connected by arrows.  Each shape represents a step of the solution process and the arrow represents the order or link among the steps. 50
  • 51. A flow chart is an organized combination of shapes, lines and text that graphically illustrate a process or structure. 51
  • 52.  Write an algorithm to find the square of a number 52
  • 53.  Before developing the algorithm, first identify the input, process and output. ◦ Input: Number whose square is required ◦ Process: Multiply the number by itself to get its square ◦ Output: Square of the number 53
  • 54.  Step 1: Input a number and stored it to Number (Number is a variable)  Step 2: Compute Number * Number and store it in Square (Square is a variable)  Step 3: Print Square 54
  • 55. 55
  • 56. 56
  • 57.  Pseudocode is another way of representing an algorithm.  It is a kind of structured English for describing algorithms  It allows the designer to focus on the logic of the algorithm without being distracted by details of language syntax  Pseudocode needs to be complete  It describe the entire logic of the algorithm so that implementation becomes a rote mechanical task of translating line by line into source code 57
  • 58.  Each instruction is written on a separate line  Keywords and indentation are used to signify particular control structures  Each set of instructions is written from top to bottom, with only one entry and one exit  Groups of statements may be formed into modules, and that group given a name. 58
  • 59.  Several keywords are often used to indicate common input, output, and processing operations  Input: READ, OBTAIN, GET  Output: PRINT, DISPLAY, SHOW  Compute: COMPUTE, CALCULATE, DETERMINE  Initialize: SET, INIT  Add one: INCREMENT, BUMP, DECREMENT 59
  • 60.  Area of Rectangle. 60
  • 61.  READ height of Rectangle  READ width of Rectangle  COMPUTE area as height times width  PRINT area of rectangle 61
  • 62.
  • 63.  Format IF Condition THEN Statements ELSE Statement ENDIF  Example IF Hours_Worked > Normal_Max THEN Display overtime message ELSE Display regular time message ENDIF 63
  • 64.  Format WHILE Condition Statements ENDWHILE  Example WHILE Population < Limit Compute Population as Population + Births ‐ Deaths ENDWHILE 64
  • 65.  Format FOR Iteration Bounds Statements ENDFOR  Example FOR each student in the list Print Register_Number ENDFOR 65
  • 66.
  • 67. 67

Hinweis der Redaktion

  1. Flow Charts are used to help programmers during the early stages of programming. Flow Charts allow the programmer to set out, in a very simple way the sequence that he/she wants for each line of the program. A flow chart is an organized combination of shapes, lines and text that graphically illustrates a process or structure. Here's an example of how you could use shapes, lines, and text to build a chart: • The shapes (such as rectangles, circles, or diamonds) represent each step or decision point in the process. • The lines show the continuity of the process, demonstrating the paths the user should follow. • The text briefly describes each part of the process. A flow chart can be used for: (1) defining and analyzing processes (2) building a step-by-step picture of the process for analysis, discussion, or communication purposes (3) defining, standardizing, or finding areas for improvement in a process