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

Similar to Part 1.ppt

Introduction to algorithn class 1
Introduction to algorithn class 1Introduction to algorithn class 1
Introduction to algorithn class 1Kumar
 
C LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHES
C LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHESC LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHES
C LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHES
HarshJha34
 
Analysis and Design of Algorithms
Analysis and Design of AlgorithmsAnalysis and Design of Algorithms
Analysis and Design of Algorithms
Bulbul Agrawal
 
2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx
RahikAhmed1
 
C programming for Computing Techniques
C programming for Computing TechniquesC programming for Computing Techniques
C programming for Computing Techniques
Appili Vamsi Krishna
 
Chapter1.1 Introduction.ppt
Chapter1.1 Introduction.pptChapter1.1 Introduction.ppt
Chapter1.1 Introduction.ppt
Tekle12
 
Chapter1.1 Introduction to design and analysis of algorithm.ppt
Chapter1.1 Introduction to design and analysis of algorithm.pptChapter1.1 Introduction to design and analysis of algorithm.ppt
Chapter1.1 Introduction to design and analysis of algorithm.ppt
Tekle12
 
Algorithms notes 2 tutorials duniya
Algorithms notes 2   tutorials duniyaAlgorithms notes 2   tutorials duniya
Algorithms notes 2 tutorials duniya
TutorialsDuniya.com
 
BCE L-2 Algorithms-and-Flowchart-ppt.ppt
BCE L-2 Algorithms-and-Flowchart-ppt.pptBCE L-2 Algorithms-and-Flowchart-ppt.ppt
BCE L-2 Algorithms-and-Flowchart-ppt.ppt
Kirti Verma
 
UNIT-2-PPTS-DAA.ppt
UNIT-2-PPTS-DAA.pptUNIT-2-PPTS-DAA.ppt
UNIT-2-PPTS-DAA.ppt
GovindUpadhyay25
 
2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life Cycle2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life Cycle
Frankie Jones
 
Algorithmic problem sloving
Algorithmic problem slovingAlgorithmic problem sloving
Algorithmic problem sloving
Mani Kandan
 
Data structures algorithms basics
Data structures   algorithms basicsData structures   algorithms basics
Data structures algorithms basics
ayeshasafdar8
 
Algorithmic problem solving
Algorithmic problem solvingAlgorithmic problem solving
Algorithmic problem solving
Prabhakaran V M
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
A. S. M. Shafi
 
Introduction to algorithms
Introduction to algorithmsIntroduction to algorithms
Introduction to algorithms
Madishetty Prathibha
 
Unit 1 python (2021 r)
Unit 1 python (2021 r)Unit 1 python (2021 r)
Unit 1 python (2021 r)
praveena p
 
Algorithm - Introduction
Algorithm - IntroductionAlgorithm - Introduction
Algorithm - Introduction
Madhu Bala
 
2-Algorithms and Complexit data structurey.pdf
2-Algorithms and Complexit data structurey.pdf2-Algorithms and Complexit data structurey.pdf
2-Algorithms and Complexit data structurey.pdf
ishan743441
 
Design and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptxDesign and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptx
Syed Zaid Irshad
 

Similar to Part 1.ppt (20)

Introduction to algorithn class 1
Introduction to algorithn class 1Introduction to algorithn class 1
Introduction to algorithn class 1
 
C LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHES
C LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHESC LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHES
C LANGUAGE-FLOWCHARTS,PSEUDOCODE,ALGORITHMS APPROCHES
 
Analysis and Design of Algorithms
Analysis and Design of AlgorithmsAnalysis and Design of Algorithms
Analysis and Design of Algorithms
 
2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx
 
C programming for Computing Techniques
C programming for Computing TechniquesC programming for Computing Techniques
C programming for Computing Techniques
 
Chapter1.1 Introduction.ppt
Chapter1.1 Introduction.pptChapter1.1 Introduction.ppt
Chapter1.1 Introduction.ppt
 
Chapter1.1 Introduction to design and analysis of algorithm.ppt
Chapter1.1 Introduction to design and analysis of algorithm.pptChapter1.1 Introduction to design and analysis of algorithm.ppt
Chapter1.1 Introduction to design and analysis of algorithm.ppt
 
Algorithms notes 2 tutorials duniya
Algorithms notes 2   tutorials duniyaAlgorithms notes 2   tutorials duniya
Algorithms notes 2 tutorials duniya
 
BCE L-2 Algorithms-and-Flowchart-ppt.ppt
BCE L-2 Algorithms-and-Flowchart-ppt.pptBCE L-2 Algorithms-and-Flowchart-ppt.ppt
BCE L-2 Algorithms-and-Flowchart-ppt.ppt
 
UNIT-2-PPTS-DAA.ppt
UNIT-2-PPTS-DAA.pptUNIT-2-PPTS-DAA.ppt
UNIT-2-PPTS-DAA.ppt
 
2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life Cycle2.2 Demonstrate the understanding of Programming Life Cycle
2.2 Demonstrate the understanding of Programming Life Cycle
 
Algorithmic problem sloving
Algorithmic problem slovingAlgorithmic problem sloving
Algorithmic problem sloving
 
Data structures algorithms basics
Data structures   algorithms basicsData structures   algorithms basics
Data structures algorithms basics
 
Algorithmic problem solving
Algorithmic problem solvingAlgorithmic problem solving
Algorithmic problem solving
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
 
Introduction to algorithms
Introduction to algorithmsIntroduction to algorithms
Introduction to algorithms
 
Unit 1 python (2021 r)
Unit 1 python (2021 r)Unit 1 python (2021 r)
Unit 1 python (2021 r)
 
Algorithm - Introduction
Algorithm - IntroductionAlgorithm - Introduction
Algorithm - Introduction
 
2-Algorithms and Complexit data structurey.pdf
2-Algorithms and Complexit data structurey.pdf2-Algorithms and Complexit data structurey.pdf
2-Algorithms and Complexit data structurey.pdf
 
Design and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptxDesign and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptx
 

More from RAJESH S

Entreprise Resource Planning s unit 2.ppt
Entreprise Resource Planning s unit 2.pptEntreprise Resource Planning s unit 2.ppt
Entreprise Resource Planning s unit 2.ppt
RAJESH S
 
Decision support systems in information management
Decision support systems in information managementDecision support systems in information management
Decision support systems in information management
RAJESH S
 
IM Unit 4 Security and its a control.ppt
IM Unit 4 Security and its a control.pptIM Unit 4 Security and its a control.ppt
IM Unit 4 Security and its a control.ppt
RAJESH S
 
unit5 Enterprise Resource Planning new trends.ppt
unit5 Enterprise Resource Planning new trends.pptunit5 Enterprise Resource Planning new trends.ppt
unit5 Enterprise Resource Planning new trends.ppt
RAJESH S
 
science engineering and technology .pptx
science engineering and technology .pptxscience engineering and technology .pptx
science engineering and technology .pptx
RAJESH S
 
policies in economics trends for engineers
policies in economics trends for engineerspolicies in economics trends for engineers
policies in economics trends for engineers
RAJESH S
 
Product Decisions and its aplication in global world
Product Decisions and its aplication in global worldProduct Decisions and its aplication in global world
Product Decisions and its aplication in global world
RAJESH S
 
Database management system basics and it applications
Database management system basics and it applicationsDatabase management system basics and it applications
Database management system basics and it applications
RAJESH S
 
Computer Animation.pptx
Computer Animation.pptxComputer Animation.pptx
Computer Animation.pptx
RAJESH S
 
IOT in agriculture.pptx
IOT in agriculture.pptxIOT in agriculture.pptx
IOT in agriculture.pptx
RAJESH S
 
18copy.pptx
18copy.pptx18copy.pptx
18copy.pptx
RAJESH S
 
ERP unit 1.ppt
ERP unit 1.pptERP unit 1.ppt
ERP unit 1.ppt
RAJESH S
 
fiscalpolicy.ppt
fiscalpolicy.pptfiscalpolicy.ppt
fiscalpolicy.ppt
RAJESH S
 
CASE Tools lab.ppt
CASE Tools lab.pptCASE Tools lab.ppt
CASE Tools lab.ppt
RAJESH S
 
DAA ppt.pptx
DAA ppt.pptxDAA ppt.pptx
DAA ppt.pptx
RAJESH S
 
DAA 1 ppt.pptx
DAA 1 ppt.pptxDAA 1 ppt.pptx
DAA 1 ppt.pptx
RAJESH S
 
ARITHMETIC LOGIC UNIT.ppt
ARITHMETIC LOGIC UNIT.pptARITHMETIC LOGIC UNIT.ppt
ARITHMETIC LOGIC UNIT.ppt
RAJESH S
 
Virtual memory translation.pptx
Virtual memory translation.pptxVirtual memory translation.pptx
Virtual memory translation.pptx
RAJESH S
 
Common memory technologies.pptx
Common memory technologies.pptxCommon memory technologies.pptx
Common memory technologies.pptx
RAJESH S
 
Components of Computer system.ppt
Components of Computer system.pptComponents of Computer system.ppt
Components of Computer system.ppt
RAJESH S
 

More from RAJESH S (20)

Entreprise Resource Planning s unit 2.ppt
Entreprise Resource Planning s unit 2.pptEntreprise Resource Planning s unit 2.ppt
Entreprise Resource Planning s unit 2.ppt
 
Decision support systems in information management
Decision support systems in information managementDecision support systems in information management
Decision support systems in information management
 
IM Unit 4 Security and its a control.ppt
IM Unit 4 Security and its a control.pptIM Unit 4 Security and its a control.ppt
IM Unit 4 Security and its a control.ppt
 
unit5 Enterprise Resource Planning new trends.ppt
unit5 Enterprise Resource Planning new trends.pptunit5 Enterprise Resource Planning new trends.ppt
unit5 Enterprise Resource Planning new trends.ppt
 
science engineering and technology .pptx
science engineering and technology .pptxscience engineering and technology .pptx
science engineering and technology .pptx
 
policies in economics trends for engineers
policies in economics trends for engineerspolicies in economics trends for engineers
policies in economics trends for engineers
 
Product Decisions and its aplication in global world
Product Decisions and its aplication in global worldProduct Decisions and its aplication in global world
Product Decisions and its aplication in global world
 
Database management system basics and it applications
Database management system basics and it applicationsDatabase management system basics and it applications
Database management system basics and it applications
 
Computer Animation.pptx
Computer Animation.pptxComputer Animation.pptx
Computer Animation.pptx
 
IOT in agriculture.pptx
IOT in agriculture.pptxIOT in agriculture.pptx
IOT in agriculture.pptx
 
18copy.pptx
18copy.pptx18copy.pptx
18copy.pptx
 
ERP unit 1.ppt
ERP unit 1.pptERP unit 1.ppt
ERP unit 1.ppt
 
fiscalpolicy.ppt
fiscalpolicy.pptfiscalpolicy.ppt
fiscalpolicy.ppt
 
CASE Tools lab.ppt
CASE Tools lab.pptCASE Tools lab.ppt
CASE Tools lab.ppt
 
DAA ppt.pptx
DAA ppt.pptxDAA ppt.pptx
DAA ppt.pptx
 
DAA 1 ppt.pptx
DAA 1 ppt.pptxDAA 1 ppt.pptx
DAA 1 ppt.pptx
 
ARITHMETIC LOGIC UNIT.ppt
ARITHMETIC LOGIC UNIT.pptARITHMETIC LOGIC UNIT.ppt
ARITHMETIC LOGIC UNIT.ppt
 
Virtual memory translation.pptx
Virtual memory translation.pptxVirtual memory translation.pptx
Virtual memory translation.pptx
 
Common memory technologies.pptx
Common memory technologies.pptxCommon memory technologies.pptx
Common memory technologies.pptx
 
Components of Computer system.ppt
Components of Computer system.pptComponents of Computer system.ppt
Components of Computer system.ppt
 

Recently uploaded

DIGITAL MARKETING COURSE IN CHENNAI.pptx
DIGITAL MARKETING COURSE IN CHENNAI.pptxDIGITAL MARKETING COURSE IN CHENNAI.pptx
DIGITAL MARKETING COURSE IN CHENNAI.pptx
FarzanaRbcomcs
 
皇冠体育- 皇冠体育官方网站- CROWN SPORTS| 立即访问【ac123.net】
皇冠体育- 皇冠体育官方网站- CROWN SPORTS| 立即访问【ac123.net】皇冠体育- 皇冠体育官方网站- CROWN SPORTS| 立即访问【ac123.net】
皇冠体育- 皇冠体育官方网站- CROWN SPORTS| 立即访问【ac123.net】
larisashrestha558
 
salivary gland disorders.pdf nothing more
salivary gland disorders.pdf nothing moresalivary gland disorders.pdf nothing more
salivary gland disorders.pdf nothing more
GokulnathMbbs
 
欧洲杯买球平台-欧洲杯买球平台推荐-欧洲杯买球平台| 立即访问【ac123.net】
欧洲杯买球平台-欧洲杯买球平台推荐-欧洲杯买球平台| 立即访问【ac123.net】欧洲杯买球平台-欧洲杯买球平台推荐-欧洲杯买球平台| 立即访问【ac123.net】
欧洲杯买球平台-欧洲杯买球平台推荐-欧洲杯买球平台| 立即访问【ac123.net】
foismail170
 
Interactive Dictionary AIDS-B.pptx aaaaaaaaaaaaaaaaaaaaaaaaaa
Interactive Dictionary AIDS-B.pptx aaaaaaaaaaaaaaaaaaaaaaaaaaInteractive Dictionary AIDS-B.pptx aaaaaaaaaaaaaaaaaaaaaaaaaa
Interactive Dictionary AIDS-B.pptx aaaaaaaaaaaaaaaaaaaaaaaaaa
23211a7274
 
The Impact of Artificial Intelligence on Modern Society.pdf
The Impact of Artificial Intelligence on Modern Society.pdfThe Impact of Artificial Intelligence on Modern Society.pdf
The Impact of Artificial Intelligence on Modern Society.pdf
ssuser3e63fc
 
Personal Brand exploration KE.pdf for assignment
Personal Brand exploration KE.pdf for assignmentPersonal Brand exploration KE.pdf for assignment
Personal Brand exploration KE.pdf for assignment
ragingokie
 
134. Reviewer Certificate in Computer Science
134. Reviewer Certificate in Computer Science134. Reviewer Certificate in Computer Science
134. Reviewer Certificate in Computer Science
Manu Mitra
 
Widal Agglutination Test: A rapid serological diagnosis of typhoid fever
Widal Agglutination Test: A rapid serological diagnosis of typhoid feverWidal Agglutination Test: A rapid serological diagnosis of typhoid fever
Widal Agglutination Test: A rapid serological diagnosis of typhoid fever
taexnic
 
欧洲杯投注网站-欧洲杯投注网站推荐-欧洲杯投注网站| 立即访问【ac123.net】
欧洲杯投注网站-欧洲杯投注网站推荐-欧洲杯投注网站| 立即访问【ac123.net】欧洲杯投注网站-欧洲杯投注网站推荐-欧洲杯投注网站| 立即访问【ac123.net】
欧洲杯投注网站-欧洲杯投注网站推荐-欧洲杯投注网站| 立即访问【ac123.net】
foismail170
 
15385-LESSON PLAN- 7TH - SS-Insian Constitution an Introduction.pdf
15385-LESSON PLAN- 7TH - SS-Insian Constitution an Introduction.pdf15385-LESSON PLAN- 7TH - SS-Insian Constitution an Introduction.pdf
15385-LESSON PLAN- 7TH - SS-Insian Constitution an Introduction.pdf
gobogo3542
 
欧洲杯投注app-欧洲杯投注app推荐-欧洲杯投注app| 立即访问【ac123.net】
欧洲杯投注app-欧洲杯投注app推荐-欧洲杯投注app| 立即访问【ac123.net】欧洲杯投注app-欧洲杯投注app推荐-欧洲杯投注app| 立即访问【ac123.net】
欧洲杯投注app-欧洲杯投注app推荐-欧洲杯投注app| 立即访问【ac123.net】
foismail170
 
han han widi kembar tapi beda han han dan widi kembar tapi sama
han han widi kembar tapi beda han han dan widi kembar tapi samahan han widi kembar tapi beda han han dan widi kembar tapi sama
han han widi kembar tapi beda han han dan widi kembar tapi sama
IrlanMalik
 
My Story of Getting into Tech By Gertrude Chilufya Westrin
My Story of Getting into Tech By Gertrude Chilufya WestrinMy Story of Getting into Tech By Gertrude Chilufya Westrin
My Story of Getting into Tech By Gertrude Chilufya Westrin
AlinaseFaith
 
Operating system. short answes and Interview questions .pdf
Operating system. short answes and Interview questions .pdfOperating system. short answes and Interview questions .pdf
Operating system. short answes and Interview questions .pdf
harikrishnahari6276
 
New Explore Careers and College Majors 2024.pdf
New Explore Careers and College Majors 2024.pdfNew Explore Careers and College Majors 2024.pdf
New Explore Careers and College Majors 2024.pdf
Dr. Mary Askew
 
Dr. Nazrul Islam, Northern University Bangladesh - CV (29.5.2024).pdf
Dr. Nazrul Islam, Northern University Bangladesh - CV (29.5.2024).pdfDr. Nazrul Islam, Northern University Bangladesh - CV (29.5.2024).pdf
Dr. Nazrul Islam, Northern University Bangladesh - CV (29.5.2024).pdf
Dr. Nazrul Islam
 
135. Reviewer Certificate in Journal of Engineering
135. Reviewer Certificate in Journal of Engineering135. Reviewer Certificate in Journal of Engineering
135. Reviewer Certificate in Journal of Engineering
Manu Mitra
 
Midterm Contract Law and Adminstration.pptx
Midterm Contract Law and Adminstration.pptxMidterm Contract Law and Adminstration.pptx
Midterm Contract Law and Adminstration.pptx
Sheldon Byron
 
132. Acta Scientific Pharmaceutical Sciences
132. Acta Scientific Pharmaceutical Sciences132. Acta Scientific Pharmaceutical Sciences
132. Acta Scientific Pharmaceutical Sciences
Manu Mitra
 

Recently uploaded (20)

DIGITAL MARKETING COURSE IN CHENNAI.pptx
DIGITAL MARKETING COURSE IN CHENNAI.pptxDIGITAL MARKETING COURSE IN CHENNAI.pptx
DIGITAL MARKETING COURSE IN CHENNAI.pptx
 
皇冠体育- 皇冠体育官方网站- CROWN SPORTS| 立即访问【ac123.net】
皇冠体育- 皇冠体育官方网站- CROWN SPORTS| 立即访问【ac123.net】皇冠体育- 皇冠体育官方网站- CROWN SPORTS| 立即访问【ac123.net】
皇冠体育- 皇冠体育官方网站- CROWN SPORTS| 立即访问【ac123.net】
 
salivary gland disorders.pdf nothing more
salivary gland disorders.pdf nothing moresalivary gland disorders.pdf nothing more
salivary gland disorders.pdf nothing more
 
欧洲杯买球平台-欧洲杯买球平台推荐-欧洲杯买球平台| 立即访问【ac123.net】
欧洲杯买球平台-欧洲杯买球平台推荐-欧洲杯买球平台| 立即访问【ac123.net】欧洲杯买球平台-欧洲杯买球平台推荐-欧洲杯买球平台| 立即访问【ac123.net】
欧洲杯买球平台-欧洲杯买球平台推荐-欧洲杯买球平台| 立即访问【ac123.net】
 
Interactive Dictionary AIDS-B.pptx aaaaaaaaaaaaaaaaaaaaaaaaaa
Interactive Dictionary AIDS-B.pptx aaaaaaaaaaaaaaaaaaaaaaaaaaInteractive Dictionary AIDS-B.pptx aaaaaaaaaaaaaaaaaaaaaaaaaa
Interactive Dictionary AIDS-B.pptx aaaaaaaaaaaaaaaaaaaaaaaaaa
 
The Impact of Artificial Intelligence on Modern Society.pdf
The Impact of Artificial Intelligence on Modern Society.pdfThe Impact of Artificial Intelligence on Modern Society.pdf
The Impact of Artificial Intelligence on Modern Society.pdf
 
Personal Brand exploration KE.pdf for assignment
Personal Brand exploration KE.pdf for assignmentPersonal Brand exploration KE.pdf for assignment
Personal Brand exploration KE.pdf for assignment
 
134. Reviewer Certificate in Computer Science
134. Reviewer Certificate in Computer Science134. Reviewer Certificate in Computer Science
134. Reviewer Certificate in Computer Science
 
Widal Agglutination Test: A rapid serological diagnosis of typhoid fever
Widal Agglutination Test: A rapid serological diagnosis of typhoid feverWidal Agglutination Test: A rapid serological diagnosis of typhoid fever
Widal Agglutination Test: A rapid serological diagnosis of typhoid fever
 
欧洲杯投注网站-欧洲杯投注网站推荐-欧洲杯投注网站| 立即访问【ac123.net】
欧洲杯投注网站-欧洲杯投注网站推荐-欧洲杯投注网站| 立即访问【ac123.net】欧洲杯投注网站-欧洲杯投注网站推荐-欧洲杯投注网站| 立即访问【ac123.net】
欧洲杯投注网站-欧洲杯投注网站推荐-欧洲杯投注网站| 立即访问【ac123.net】
 
15385-LESSON PLAN- 7TH - SS-Insian Constitution an Introduction.pdf
15385-LESSON PLAN- 7TH - SS-Insian Constitution an Introduction.pdf15385-LESSON PLAN- 7TH - SS-Insian Constitution an Introduction.pdf
15385-LESSON PLAN- 7TH - SS-Insian Constitution an Introduction.pdf
 
欧洲杯投注app-欧洲杯投注app推荐-欧洲杯投注app| 立即访问【ac123.net】
欧洲杯投注app-欧洲杯投注app推荐-欧洲杯投注app| 立即访问【ac123.net】欧洲杯投注app-欧洲杯投注app推荐-欧洲杯投注app| 立即访问【ac123.net】
欧洲杯投注app-欧洲杯投注app推荐-欧洲杯投注app| 立即访问【ac123.net】
 
han han widi kembar tapi beda han han dan widi kembar tapi sama
han han widi kembar tapi beda han han dan widi kembar tapi samahan han widi kembar tapi beda han han dan widi kembar tapi sama
han han widi kembar tapi beda han han dan widi kembar tapi sama
 
My Story of Getting into Tech By Gertrude Chilufya Westrin
My Story of Getting into Tech By Gertrude Chilufya WestrinMy Story of Getting into Tech By Gertrude Chilufya Westrin
My Story of Getting into Tech By Gertrude Chilufya Westrin
 
Operating system. short answes and Interview questions .pdf
Operating system. short answes and Interview questions .pdfOperating system. short answes and Interview questions .pdf
Operating system. short answes and Interview questions .pdf
 
New Explore Careers and College Majors 2024.pdf
New Explore Careers and College Majors 2024.pdfNew Explore Careers and College Majors 2024.pdf
New Explore Careers and College Majors 2024.pdf
 
Dr. Nazrul Islam, Northern University Bangladesh - CV (29.5.2024).pdf
Dr. Nazrul Islam, Northern University Bangladesh - CV (29.5.2024).pdfDr. Nazrul Islam, Northern University Bangladesh - CV (29.5.2024).pdf
Dr. Nazrul Islam, Northern University Bangladesh - CV (29.5.2024).pdf
 
135. Reviewer Certificate in Journal of Engineering
135. Reviewer Certificate in Journal of Engineering135. Reviewer Certificate in Journal of Engineering
135. Reviewer Certificate in Journal of Engineering
 
Midterm Contract Law and Adminstration.pptx
Midterm Contract Law and Adminstration.pptxMidterm Contract Law and Adminstration.pptx
Midterm Contract Law and Adminstration.pptx
 
132. Acta Scientific Pharmaceutical Sciences
132. Acta Scientific Pharmaceutical Sciences132. Acta Scientific Pharmaceutical Sciences
132. Acta Scientific Pharmaceutical Sciences
 

Part 1.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.

Editor's Notes

  1. 1
  2. 3
  3. 4
  4. 6
  5. 8
  6. 9
  7. 12
  8. 13