SlideShare a Scribd company logo
Programming Fundamentals --> Ch1.
Problem solving
1
Fundamentals of Algorithms
Problem Solving
Fundamentals of Algorithmic Problem Solving
Programming Fundamentals --> Ch1.
Problem solving
3
Problem Solving
• Algorithm
 Step-by-step problem-solving process
 Solution achieved in finite amount of time
 Problem Solution by computer
Programming Fundamentals --> Ch1.
Problem solving
4
Problem Solving Process
• Phase 1 - Analyze the problem
 Outline the problem and its requirements
 Design (algorithm) to solve the problem ( Flow chart, pseudo code)
 Algorithm tracing
• Phase 2 - Implement the algorithm
 Implement the algorithm in code (in Programming Language 
Program)
 Verify that the algorithm works
• Phase 3 - Maintenance
 Use and modify the program if the requirements changes
Choosing between Exact and Approximate Problem Solving
• The next principal decision is to choose between
solving the problem exactly (exact algorithm) or
solving the problem approximately (approximation
algorithm).
Exact algorithm
Eg. extracting square roots, solving nonlinear
equations, and evaluating definite integrals.
Approximation algorithm
Eg. Vertex Cover, Traveling Salesman Problem
Programming Fundamentals --> Ch1.
Problem solving
6
Analyze the Problem (1)
Design Algorithm
• Pseudocode - is a mixture of a natural language and
programming language constructs. Pseudo code is usually more
precise than natural language.
• Flow chart - a method of expressing an algorithm by a
collection of connected geometric shapes containing
descriptions of the algorithm’s steps
Programming Fundamentals --> Ch1.
Problem solving
7
Flow Chart Symbols
Start and End
Input / output
Selection
Calculation
Data
Flow
• A Flowchart is
 An algorithm graphical representation.
 Written as a combination of the following graphical
notations:
Programming Fundamentals --> Ch1.
Problem solving
8
• Pseudo-code:
<Algorithm name>
The comment lines “//”
Begin
<data definition>
<actions>
End
Programming Fundamentals --> Ch1.
Problem solving
9
Analyze the Problem (1)
Algorithm Tracing
 Draw flowchart
 Find all possible paths
 Check each path with appropriate input data
 Observed Outputs not conform to the expected ones  error in the
algorithm.
Proving an Algorithm’s Correctness/verification
•Once an algorithm has been specified, you have to prove its
correctness. i.e. you have to prove that the algorithm yields a
required result for every legitimate input in a finite amount of
time.
Analyzing an Algorithm
two kinds of analyzing the algorithm efficiency:
• time efficiency- indicating how fast the algorithm runs
• space efficiency-indicating how much extra memory it uses.
•Range of inputs-These factors are not satisfactory then redesign
the algorithm.
Programming Fundamentals --> Ch1.
Problem solving
11
 Computer Stage: after completing the program, the
computer must do the following:
1.Compilation:
2.Execution: when the program become don’t has errors, the
computer execute it to produce the output
Programming Fundamentals --> Ch1.
Problem solving
12
Implement the algorithm
• Errors are of three types:
. syntax errors
. run-time errors
. logic errors
• Syntax errors: detected by the C compiler
. source code does not conform to one or more of C’s grammar
rules
. examples of syntax errors: undeclared variable, …
• Often one mistake leads to multiple error messages – can
be confusing
Programming Fundamentals --> Ch1.
Problem solving
13
Implement the algorithm
• Run-time errors. detected and displayed by computer during
execution.
- Occur when program directs computer to perform illegal
operation.
- will stop program execution and display message
• Logic errors.
- caused by faulty algorithm
- sign of error: incorrect program output
- cure: thorough testing and comparison with expected results
A logic error is also referred to as a bug, so finding logic errors is
called debugging.

More Related Content

PPT
Programs_Problem_Solving_Algorithms.ppt
PPT
part_1 (1).ppt
PDF
Algorithms notes 2 tutorials duniya
PPTX
UNIT-1.pptx python for engineering first year students
PDF
Problem solving methodology
PPTX
Data Structures_Introduction to algorithms.pptx
PPSX
Ds03 part i algorithms by jyoti lakhani
PPTX
Design and analysis of algorithms Module-I.pptx
Programs_Problem_Solving_Algorithms.ppt
part_1 (1).ppt
Algorithms notes 2 tutorials duniya
UNIT-1.pptx python for engineering first year students
Problem solving methodology
Data Structures_Introduction to algorithms.pptx
Ds03 part i algorithms by jyoti lakhani
Design and analysis of algorithms Module-I.pptx

Similar to Analysis of Algorithm Part one analysis.ppt (20)

PPT
AOA Week 01.ppt
PDF
PROGRAMMING IN C UNIT I.pdffffffffffffffffffffffffd
PPTX
Algrithms and frowcharts.pptx
PPSX
CC-112-Lec.1.ppsx
PPTX
Module 1 python.pptx
PPTX
Programming in C - Problem Solving using C
PPTX
design analysis of algorithmaa unit 1.pptx
PPT
Unit 1 python (2021 r)
PDF
Algorithm.pdf
PDF
Lecture 2 role of algorithms in computing
PPTX
IntroductionToAlgo_v1_1709293290768 (2).pptx
PPTX
C LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHES
PPTX
ANALYSIS AND DESIGN OF ALGORITHMS -M1-PPT
PPTX
Chp-1 DAA (2).pptx design analysis and algoritham presentation
PPT
UNIT-1-PPTS-DAA INTRO WITH DIVIDE AND CONQUER
PPT
UNIT 1- Design Analysis of algorithms and its working
PPT
UNIT-1-PPTS-DAA_INTRODUCTION_TO_DAA_GH.ppt
PPT
UNIT-1-PPTS-DAA.ppt
PPT
UNIT-1-PPTS-DAA.ppt
PPT
Introduction to Design Algorithm And Analysis.ppt
AOA Week 01.ppt
PROGRAMMING IN C UNIT I.pdffffffffffffffffffffffffd
Algrithms and frowcharts.pptx
CC-112-Lec.1.ppsx
Module 1 python.pptx
Programming in C - Problem Solving using C
design analysis of algorithmaa unit 1.pptx
Unit 1 python (2021 r)
Algorithm.pdf
Lecture 2 role of algorithms in computing
IntroductionToAlgo_v1_1709293290768 (2).pptx
C LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHES
ANALYSIS AND DESIGN OF ALGORITHMS -M1-PPT
Chp-1 DAA (2).pptx design analysis and algoritham presentation
UNIT-1-PPTS-DAA INTRO WITH DIVIDE AND CONQUER
UNIT 1- Design Analysis of algorithms and its working
UNIT-1-PPTS-DAA_INTRODUCTION_TO_DAA_GH.ppt
UNIT-1-PPTS-DAA.ppt
UNIT-1-PPTS-DAA.ppt
Introduction to Design Algorithm And Analysis.ppt
Ad

More from RAJESH S (20)

PDF
Service Operation Managements Unit 1.pdf
PPT
Unit II Ethernet devices and Sub categories.ppt
PPT
Connecting devices in Computer parts.ppt
PPTX
unitios-22112405585Operational 3-5fc1b7da.pptx
PPT
Analysis of Algorithm DAA notes Part 1.ppt
PPTX
Logical link protocols and service data.pptx
PPT
error detection and Error control detection .ppt
PPT
Entreprise Resource Planning s unit 2.ppt
PPTX
Decision support systems in information management
PPT
IM Unit 4 Security and its a control.ppt
PPT
unit5 Enterprise Resource Planning new trends.ppt
PPTX
science engineering and technology .pptx
PPTX
policies in economics trends for engineers
PDF
Product Decisions and its aplication in global world
PPT
Database management system basics and it applications
PPTX
Computer Animation.pptx
PPTX
IOT in agriculture.pptx
PPTX
18copy.pptx
PPT
ERP unit 1.ppt
PPT
fiscalpolicy.ppt
Service Operation Managements Unit 1.pdf
Unit II Ethernet devices and Sub categories.ppt
Connecting devices in Computer parts.ppt
unitios-22112405585Operational 3-5fc1b7da.pptx
Analysis of Algorithm DAA notes Part 1.ppt
Logical link protocols and service data.pptx
error detection and Error control detection .ppt
Entreprise Resource Planning s unit 2.ppt
Decision support systems in information management
IM Unit 4 Security and its a control.ppt
unit5 Enterprise Resource Planning new trends.ppt
science engineering and technology .pptx
policies in economics trends for engineers
Product Decisions and its aplication in global world
Database management system basics and it applications
Computer Animation.pptx
IOT in agriculture.pptx
18copy.pptx
ERP unit 1.ppt
fiscalpolicy.ppt
Ad

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...
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Complications of Minimal Access Surgery at WLH
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PPTX
Presentation on HIE in infants and its manifestations
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
Cell Types and Its function , kingdom of life
PDF
Computing-Curriculum for Schools in Ghana
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
RMMM.pdf make it easy to upload and study
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Chinmaya Tiranga quiz Grand Finale.pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Complications of Minimal Access Surgery at WLH
Module 4: Burden of Disease Tutorial Slides S2 2025
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Presentation on HIE in infants and its manifestations
Supply Chain Operations Speaking Notes -ICLT Program
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
human mycosis Human fungal infections are called human mycosis..pptx
Cell Types and Its function , kingdom of life
Computing-Curriculum for Schools in Ghana
Anesthesia in Laparoscopic Surgery in India
O7-L3 Supply Chain Operations - ICLT Program
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx

Analysis of Algorithm Part one analysis.ppt

  • 1. Programming Fundamentals --> Ch1. Problem solving 1 Fundamentals of Algorithms Problem Solving
  • 2. Fundamentals of Algorithmic Problem Solving
  • 3. Programming Fundamentals --> Ch1. Problem solving 3 Problem Solving • Algorithm  Step-by-step problem-solving process  Solution achieved in finite amount of time  Problem Solution by computer
  • 4. Programming Fundamentals --> Ch1. Problem solving 4 Problem Solving Process • Phase 1 - Analyze the problem  Outline the problem and its requirements  Design (algorithm) to solve the problem ( Flow chart, pseudo code)  Algorithm tracing • Phase 2 - Implement the algorithm  Implement the algorithm in code (in Programming Language  Program)  Verify that the algorithm works • Phase 3 - Maintenance  Use and modify the program if the requirements changes
  • 5. Choosing between Exact and Approximate Problem Solving • The next principal decision is to choose between solving the problem exactly (exact algorithm) or solving the problem approximately (approximation algorithm). Exact algorithm Eg. extracting square roots, solving nonlinear equations, and evaluating definite integrals. Approximation algorithm Eg. Vertex Cover, Traveling Salesman Problem
  • 6. Programming Fundamentals --> Ch1. Problem solving 6 Analyze the Problem (1) Design Algorithm • Pseudocode - is a mixture of a natural language and programming language constructs. Pseudo code is usually more precise than natural language. • Flow chart - a method of expressing an algorithm by a collection of connected geometric shapes containing descriptions of the algorithm’s steps
  • 7. Programming Fundamentals --> Ch1. Problem solving 7 Flow Chart Symbols Start and End Input / output Selection Calculation Data Flow • A Flowchart is  An algorithm graphical representation.  Written as a combination of the following graphical notations:
  • 8. Programming Fundamentals --> Ch1. Problem solving 8 • Pseudo-code: <Algorithm name> The comment lines “//” Begin <data definition> <actions> End
  • 9. Programming Fundamentals --> Ch1. Problem solving 9 Analyze the Problem (1) Algorithm Tracing  Draw flowchart  Find all possible paths  Check each path with appropriate input data  Observed Outputs not conform to the expected ones  error in the algorithm.
  • 10. Proving an Algorithm’s Correctness/verification •Once an algorithm has been specified, you have to prove its correctness. i.e. you have to prove that the algorithm yields a required result for every legitimate input in a finite amount of time. Analyzing an Algorithm two kinds of analyzing the algorithm efficiency: • time efficiency- indicating how fast the algorithm runs • space efficiency-indicating how much extra memory it uses. •Range of inputs-These factors are not satisfactory then redesign the algorithm.
  • 11. Programming Fundamentals --> Ch1. Problem solving 11  Computer Stage: after completing the program, the computer must do the following: 1.Compilation: 2.Execution: when the program become don’t has errors, the computer execute it to produce the output
  • 12. Programming Fundamentals --> Ch1. Problem solving 12 Implement the algorithm • Errors are of three types: . syntax errors . run-time errors . logic errors • Syntax errors: detected by the C compiler . source code does not conform to one or more of C’s grammar rules . examples of syntax errors: undeclared variable, … • Often one mistake leads to multiple error messages – can be confusing
  • 13. Programming Fundamentals --> Ch1. Problem solving 13 Implement the algorithm • Run-time errors. detected and displayed by computer during execution. - Occur when program directs computer to perform illegal operation. - will stop program execution and display message • Logic errors. - caused by faulty algorithm - sign of error: incorrect program output - cure: thorough testing and comparison with expected results A logic error is also referred to as a bug, so finding logic errors is called debugging.