際際滷

際際滷Share a Scribd company logo
Introduction to Algorithm
Design
Rangaballav Pradhan
Asst. Professor, Dept. of CSE, ITER,
SOA Deemed to be University
Introducing Algorithms
What is an Algorithm?
 Computer
 Computing/ Data Processing
 Complex Operations
 Programming Language
 A program
 A Problem
 An Algorithm
 A solution
Definition
 An algorithm is a finite sequence of basic and well-defined
instructions for solving a class of problems or to perform a
specific computation.
Characteristics of algorithms
Input  0
Output  1
Finiteness
Definiteness
Effectiveness
Correctness
Efficiency
Process of problem solving
 Define the problem (specifications, input and constraints)
 Develop a model using problem specifications and constraints
 Define the specification of an algorithm
 Design an algorithm using a suitable design approach
 Verify the correctness of the algorithm
 Analysis of the algorithm
 Implement the algorithm
 Program testing
 Documentation or publish the algorithm
Significance of algorithms
 To find the solutions for complex computational problems
 To improve the efficiency of a computer program
 Proper utilization of computing resources
 To handle the processing of larger problem instances
efficiently
Example: GCD of two numbers
 The greatest common divisor (GCD) of two or more integers, which
are not all zero, is the largest positive integer that divides each of the
integers.
 For example, the GCD of 8 and 12 is 4, that is, gcd(8,12)=4.
 Method 1: Using prime factorizations:
gcd (48, 120)
48 = 2 x 2 x 2 x 2 x 3
120 = 2 x 2 x 2 x 3 x 5
Gcd = 2 x 2 x 2 x 3
=24
gcd (a,b)
1. Factorize a using prime factors
2. Factorize b using prime factors
3. Find the common prime factors of a and b
4. Multiply the common prime factors
 Begin
 if a = 0 OR b = 0, then
 return 0
 if a = b, then
 return b
 if a > b, then
 return findGCD(a-b, b)
 else
 return findGCD(a, b-a)
 End
Method 2: Euclidian Algorithm 1
 Example:
gcd (48, 120)
 gcd (48, 120-48)
 gcd (48, 72)
 gcd (48, 72-48)
 gcd (48, 24)
 gcd (24, 24)
 return 24
 gcd = 24
 If A = 0 then
 GCD(a, b) = b
 If b = 0 then
 GCD(a, b) = a
 GCD(a, b) = GCD(b, a % b)
Method 3: Euclidian Algorithm 2
 Example:
gcd (48, 120)
 gcd (120, 48)
 gcd (48, 24)
 gcd (24, 0)
 gcd = 24
 English-like: Using some natural language to explain the steps
 Flowchart: Using diagrammatic representation of the steps
 Pseudocode: Using natural language, symbolic abbreviations
and mathematical notations to write a programming language
like structure but not exactly a program.
Algorithm Writing Formats
for i <- 1 to length(A)
x <- A[i]
j <- i
while j > 0 and A[j-1] > x
A[j] <- A[j-1]
j <- j - 1
A[j] <- x
Algorithm
Design Analysis
Pre-requisites
Formulation
Testing
Time complexity
Space complexity
 The problem definition that is to be solved by the algorithm.
 The constraints of the problem that must be considered while
solving the problem.
 The input to be taken to solve the problem instance.
 The output to be expected when the problem is solved.
 The design approach to be followed.
Algorithm Design: Pre-requisites
 Various design approaches exist:
1. Brute force
2. Divide and conquer
3. Greedy algorithm
4. Dynamic programming
5. Backtracking algorithm
6. Branch and Bound
Algorithm Design: Formulation/Definition
 Recursive vs Iterative: A recursive algorithm calls itself again and again
until a base condition is met whereas iterative algorithms use loops to
solve any problem.
 Exact vs Approximate: Algorithms that are capable of finding an exact
optimal solution for a problem are known as the exact algorithm. For
some problems, it is not possible to find the most optimized solution. In
such cases an approximation algorithm is used that finds an approximate
solution to a problem which may not be optimal but is near optimal.
 Serial vs Parallel vs Distributed: In serial algorithms, one instruction is
executed at a time while parallel algorithms divide the problem into
subproblems and execute them on different processors. If parallel
algorithms are distributed on different machines over a network, then they
are known as distributed algorithms.
Algorithm Design: Testing/Implementation
 Analysis refers to the computation of complexity of a given
algorithm
 Analysis gives a measure of efficiency of the algorithm in terms
of resource consumption
 Mainly two parameters are considered for analysis of
algorithms: the amount of running time and the memory space.
 The running time of an algorithm is expressed as a function of
the input size and is known as time complexity and the volume
of memory space consumed is known as space complexity.
Analysis of Algorithm
 Priori Analysis: A priori analysis means checking the algorithm
before its implementation. In this, the algorithm is checked when it
is written in the form of theoretical steps. This Efficiency of an
algorithm is measured by assuming that all other factors, for
example, processor speed, are constant and have no effect on the
implementation. It is in this method, that the Algorithm Complexity
is determined.
 Posterior Analysis: A posterior analysis means checking the
algorithm after its implementation. In this, the algorithm is checked
by implementing it in any programming language and executing it.
This analysis helps to get the actual and real analysis report about
correctness, space required, time consumed etc.
Analysis of Algorithm

More Related Content

Similar to 1_Introduction.pptx (20)

introduction to analysis of algorithm in computer science
introduction to analysis of algorithm in computer scienceintroduction to analysis of algorithm in computer science
introduction to analysis of algorithm in computer science
tissandavid
Introduction to analysis algorithm in computer Science
Introduction to analysis algorithm in computer ScienceIntroduction to analysis algorithm in computer Science
Introduction to analysis algorithm in computer Science
tissandavid
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
Algo_Lecture01.pptx
Algo_Lecture01.pptxAlgo_Lecture01.pptx
Algo_Lecture01.pptx
ShaistaRiaz4
Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis
Dr. Pankaj Agarwal
CS8461 - Design and Analysis of Algorithms
CS8461 - Design and Analysis of AlgorithmsCS8461 - Design and Analysis of Algorithms
CS8461 - Design and Analysis of Algorithms
Krishnan MuthuManickam
problem solving and algorithm development
problem solving and algorithm developmentproblem solving and algorithm development
problem solving and algorithm development
jessicajames100
CH-1.1 Introduction (1).pptx
CH-1.1 Introduction (1).pptxCH-1.1 Introduction (1).pptx
CH-1.1 Introduction (1).pptx
satvikkushwaha1
Chapter-1-Introduction-to-Aglorithms.pdf
Chapter-1-Introduction-to-Aglorithms.pdfChapter-1-Introduction-to-Aglorithms.pdf
Chapter-1-Introduction-to-Aglorithms.pdf
Shanmuganathan C
AoA Lec Design of algorithm spresentation
AoA Lec Design of algorithm spresentationAoA Lec Design of algorithm spresentation
AoA Lec Design of algorithm spresentation
HamzaSadaat
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
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
International Islamic University
Algorithm and C code related to data structure
Algorithm and C code related to data structureAlgorithm and C code related to data structure
Algorithm and C code related to data structure
Self-Employed
Unit 1, ADA.pptx
Unit 1, ADA.pptxUnit 1, ADA.pptx
Unit 1, ADA.pptx
jinkhatima
Part 1.ppt
Part 1.pptPart 1.ppt
Part 1.ppt
RAJESH S
Lec1.ppt
Lec1.pptLec1.ppt
Lec1.ppt
ssuser8bddb2
Paper Study: Melding the data decision pipeline
Paper Study: Melding the data decision pipelinePaper Study: Melding the data decision pipeline
Paper Study: Melding the data decision pipeline
ChenYiHuang5
2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx
RahikAhmed1
Analysis of Algorithm DAA notes Part 1.ppt
Analysis of Algorithm DAA notes Part 1.pptAnalysis of Algorithm DAA notes Part 1.ppt
Analysis of Algorithm DAA notes Part 1.ppt
RAJESH S
introduction to analysis of algorithm in computer science
introduction to analysis of algorithm in computer scienceintroduction to analysis of algorithm in computer science
introduction to analysis of algorithm in computer science
tissandavid
Introduction to analysis algorithm in computer Science
Introduction to analysis algorithm in computer ScienceIntroduction to analysis algorithm in computer Science
Introduction to analysis algorithm in computer Science
tissandavid
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
Algo_Lecture01.pptx
Algo_Lecture01.pptxAlgo_Lecture01.pptx
Algo_Lecture01.pptx
ShaistaRiaz4
Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis
Dr. Pankaj Agarwal
CS8461 - Design and Analysis of Algorithms
CS8461 - Design and Analysis of AlgorithmsCS8461 - Design and Analysis of Algorithms
CS8461 - Design and Analysis of Algorithms
Krishnan MuthuManickam
problem solving and algorithm development
problem solving and algorithm developmentproblem solving and algorithm development
problem solving and algorithm development
jessicajames100
CH-1.1 Introduction (1).pptx
CH-1.1 Introduction (1).pptxCH-1.1 Introduction (1).pptx
CH-1.1 Introduction (1).pptx
satvikkushwaha1
Chapter-1-Introduction-to-Aglorithms.pdf
Chapter-1-Introduction-to-Aglorithms.pdfChapter-1-Introduction-to-Aglorithms.pdf
Chapter-1-Introduction-to-Aglorithms.pdf
Shanmuganathan C
AoA Lec Design of algorithm spresentation
AoA Lec Design of algorithm spresentationAoA Lec Design of algorithm spresentation
AoA Lec Design of algorithm spresentation
HamzaSadaat
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
Algorithm and C code related to data structure
Algorithm and C code related to data structureAlgorithm and C code related to data structure
Algorithm and C code related to data structure
Self-Employed
Unit 1, ADA.pptx
Unit 1, ADA.pptxUnit 1, ADA.pptx
Unit 1, ADA.pptx
jinkhatima
Part 1.ppt
Part 1.pptPart 1.ppt
Part 1.ppt
RAJESH S
Paper Study: Melding the data decision pipeline
Paper Study: Melding the data decision pipelinePaper Study: Melding the data decision pipeline
Paper Study: Melding the data decision pipeline
ChenYiHuang5
2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx2. Introduction to Algorithm.pptx
2. Introduction to Algorithm.pptx
RahikAhmed1
Analysis of Algorithm DAA notes Part 1.ppt
Analysis of Algorithm DAA notes Part 1.pptAnalysis of Algorithm DAA notes Part 1.ppt
Analysis of Algorithm DAA notes Part 1.ppt
RAJESH S

More from ASVKVinayak (8)

LECTURE 0.pptx
LECTURE 0.pptxLECTURE 0.pptx
LECTURE 0.pptx
ASVKVinayak
questions.pptx
questions.pptxquestions.pptx
questions.pptx
ASVKVinayak
12-greedy.ppt
12-greedy.ppt12-greedy.ppt
12-greedy.ppt
ASVKVinayak
Digital Logic-Lecture19.pptx
Digital Logic-Lecture19.pptxDigital Logic-Lecture19.pptx
Digital Logic-Lecture19.pptx
ASVKVinayak
26.ppt
26.ppt26.ppt
26.ppt
ASVKVinayak
interdependence.ppt
interdependence.pptinterdependence.ppt
interdependence.ppt
ASVKVinayak
Disaster management Cyclone.pptx
Disaster management Cyclone.pptxDisaster management Cyclone.pptx
Disaster management Cyclone.pptx
ASVKVinayak
LOGIC DESIGN-Lecture24.pptx
LOGIC DESIGN-Lecture24.pptxLOGIC DESIGN-Lecture24.pptx
LOGIC DESIGN-Lecture24.pptx
ASVKVinayak
LECTURE 0.pptx
LECTURE 0.pptxLECTURE 0.pptx
LECTURE 0.pptx
ASVKVinayak
questions.pptx
questions.pptxquestions.pptx
questions.pptx
ASVKVinayak
12-greedy.ppt
12-greedy.ppt12-greedy.ppt
12-greedy.ppt
ASVKVinayak
Digital Logic-Lecture19.pptx
Digital Logic-Lecture19.pptxDigital Logic-Lecture19.pptx
Digital Logic-Lecture19.pptx
ASVKVinayak
interdependence.ppt
interdependence.pptinterdependence.ppt
interdependence.ppt
ASVKVinayak
Disaster management Cyclone.pptx
Disaster management Cyclone.pptxDisaster management Cyclone.pptx
Disaster management Cyclone.pptx
ASVKVinayak
LOGIC DESIGN-Lecture24.pptx
LOGIC DESIGN-Lecture24.pptxLOGIC DESIGN-Lecture24.pptx
LOGIC DESIGN-Lecture24.pptx
ASVKVinayak

Recently uploaded (20)

cPanel Dedicated Server Hosting at Top-Tier Data Center comes with a Premier ...
cPanel Dedicated Server Hosting at Top-Tier Data Center comes with a Premier ...cPanel Dedicated Server Hosting at Top-Tier Data Center comes with a Premier ...
cPanel Dedicated Server Hosting at Top-Tier Data Center comes with a Premier ...
soniaseo850
BSEO - The Ultimate GA4 Audit - Anna Lewis - Polka Dot Data
BSEO - The Ultimate GA4 Audit - Anna Lewis - Polka Dot DataBSEO - The Ultimate GA4 Audit - Anna Lewis - Polka Dot Data
BSEO - The Ultimate GA4 Audit - Anna Lewis - Polka Dot Data
Anna Lewis
01125867_HPE_Primera_Customer_Presentation_FINAL.pptx
01125867_HPE_Primera_Customer_Presentation_FINAL.pptx01125867_HPE_Primera_Customer_Presentation_FINAL.pptx
01125867_HPE_Primera_Customer_Presentation_FINAL.pptx
ali2k2sec
LITERATURE-MODEL.pptxddddddddddddddddddddddddddddddddd
LITERATURE-MODEL.pptxdddddddddddddddddddddddddddddddddLITERATURE-MODEL.pptxddddddddddddddddddddddddddddddddd
LITERATURE-MODEL.pptxddddddddddddddddddddddddddddddddd
Maimai708843
Advice vs Criticism which one is good and not.pptx
Advice vs Criticism which one is good and not.pptxAdvice vs Criticism which one is good and not.pptx
Advice vs Criticism which one is good and not.pptx
thecorneredtigers
Hadoop-and-R-Programming-Powering-Big-Data-Analytics.pptx
Hadoop-and-R-Programming-Powering-Big-Data-Analytics.pptxHadoop-and-R-Programming-Powering-Big-Data-Analytics.pptx
Hadoop-and-R-Programming-Powering-Big-Data-Analytics.pptx
MdTahammulNoor
Introduction to Microsoft Power BI is a business analytics service
Introduction to Microsoft Power BI is a business analytics serviceIntroduction to Microsoft Power BI is a business analytics service
Introduction to Microsoft Power BI is a business analytics service
Kongu Engineering College, Perundurai, Erode
Indian Smm Panel.docxIndian Smm Panel.docx
Indian Smm Panel.docxIndian Smm Panel.docxIndian Smm Panel.docxIndian Smm Panel.docx
Indian Smm Panel.docxIndian Smm Panel.docx
wasifkhan196986
Risk Based Supervision Model: Introduction
Risk Based Supervision Model: IntroductionRisk Based Supervision Model: Introduction
Risk Based Supervision Model: Introduction
ShohanurRahman76
Chapter-4-Plane-Wave-Propagation-pdf.pdf
Chapter-4-Plane-Wave-Propagation-pdf.pdfChapter-4-Plane-Wave-Propagation-pdf.pdf
Chapter-4-Plane-Wave-Propagation-pdf.pdf
ShamsAli42
Visionaize for Visionaize AI Powered Solution For Thermal Power Plant.pptx
Visionaize  for Visionaize AI Powered Solution For Thermal Power Plant.pptxVisionaize  for Visionaize AI Powered Solution For Thermal Power Plant.pptx
Visionaize for Visionaize AI Powered Solution For Thermal Power Plant.pptx
SumantaBasu12
7. PHP and gaghhgashgfsgajhfkhshfasMySQL.pptx
7. PHP and gaghhgashgfsgajhfkhshfasMySQL.pptx7. PHP and gaghhgashgfsgajhfkhshfasMySQL.pptx
7. PHP and gaghhgashgfsgajhfkhshfasMySQL.pptx
berihun18
PPTjhjhghhhghghghggvgfggffgftftftftftft.ppt
PPTjhjhghhhghghghggvgfggffgftftftftftft.pptPPTjhjhghhhghghghggvgfggffgftftftftftft.ppt
PPTjhjhghhhghghghggvgfggffgftftftftftft.ppt
vmanjusundertamil21
CPT OPT FEB 2025 TENNEY_Jamespptx university
CPT OPT FEB 2025 TENNEY_Jamespptx universityCPT OPT FEB 2025 TENNEY_Jamespptx university
CPT OPT FEB 2025 TENNEY_Jamespptx university
gobindsingh1107
PPT_OOSE software engineering data .pptx
PPT_OOSE software engineering data .pptxPPT_OOSE software engineering data .pptx
PPT_OOSE software engineering data .pptx
ssuser2d043c
This presentation detail concepts of cryptocurrency
This presentation detail concepts of cryptocurrencyThis presentation detail concepts of cryptocurrency
This presentation detail concepts of cryptocurrency
Aslbtr
Data-Ethics-and-Privacy-What-Every-Analyst-Should-Know
Data-Ethics-and-Privacy-What-Every-Analyst-Should-KnowData-Ethics-and-Privacy-What-Every-Analyst-Should-Know
Data-Ethics-and-Privacy-What-Every-Analyst-Should-Know
Ozias Rondon
Information Security Management-Planning 1.pptx
Information Security Management-Planning 1.pptxInformation Security Management-Planning 1.pptx
Information Security Management-Planning 1.pptx
FrancisFayiah
The rise of AI Agents - Beyond Automation_ The Rise of AI Agents in Service ...
The rise of AI Agents -  Beyond Automation_ The Rise of AI Agents in Service ...The rise of AI Agents -  Beyond Automation_ The Rise of AI Agents in Service ...
The rise of AI Agents - Beyond Automation_ The Rise of AI Agents in Service ...
Yasen Lilov
brightonSEO - Metehan Yesilyurt - Generative AI & GEO: the new SEO race and h...
brightonSEO - Metehan Yesilyurt - Generative AI & GEO: the new SEO race and h...brightonSEO - Metehan Yesilyurt - Generative AI & GEO: the new SEO race and h...
brightonSEO - Metehan Yesilyurt - Generative AI & GEO: the new SEO race and h...
Metehan Yeilyurt
cPanel Dedicated Server Hosting at Top-Tier Data Center comes with a Premier ...
cPanel Dedicated Server Hosting at Top-Tier Data Center comes with a Premier ...cPanel Dedicated Server Hosting at Top-Tier Data Center comes with a Premier ...
cPanel Dedicated Server Hosting at Top-Tier Data Center comes with a Premier ...
soniaseo850
BSEO - The Ultimate GA4 Audit - Anna Lewis - Polka Dot Data
BSEO - The Ultimate GA4 Audit - Anna Lewis - Polka Dot DataBSEO - The Ultimate GA4 Audit - Anna Lewis - Polka Dot Data
BSEO - The Ultimate GA4 Audit - Anna Lewis - Polka Dot Data
Anna Lewis
01125867_HPE_Primera_Customer_Presentation_FINAL.pptx
01125867_HPE_Primera_Customer_Presentation_FINAL.pptx01125867_HPE_Primera_Customer_Presentation_FINAL.pptx
01125867_HPE_Primera_Customer_Presentation_FINAL.pptx
ali2k2sec
LITERATURE-MODEL.pptxddddddddddddddddddddddddddddddddd
LITERATURE-MODEL.pptxdddddddddddddddddddddddddddddddddLITERATURE-MODEL.pptxddddddddddddddddddddddddddddddddd
LITERATURE-MODEL.pptxddddddddddddddddddddddddddddddddd
Maimai708843
Advice vs Criticism which one is good and not.pptx
Advice vs Criticism which one is good and not.pptxAdvice vs Criticism which one is good and not.pptx
Advice vs Criticism which one is good and not.pptx
thecorneredtigers
Hadoop-and-R-Programming-Powering-Big-Data-Analytics.pptx
Hadoop-and-R-Programming-Powering-Big-Data-Analytics.pptxHadoop-and-R-Programming-Powering-Big-Data-Analytics.pptx
Hadoop-and-R-Programming-Powering-Big-Data-Analytics.pptx
MdTahammulNoor
Indian Smm Panel.docxIndian Smm Panel.docx
Indian Smm Panel.docxIndian Smm Panel.docxIndian Smm Panel.docxIndian Smm Panel.docx
Indian Smm Panel.docxIndian Smm Panel.docx
wasifkhan196986
Risk Based Supervision Model: Introduction
Risk Based Supervision Model: IntroductionRisk Based Supervision Model: Introduction
Risk Based Supervision Model: Introduction
ShohanurRahman76
Chapter-4-Plane-Wave-Propagation-pdf.pdf
Chapter-4-Plane-Wave-Propagation-pdf.pdfChapter-4-Plane-Wave-Propagation-pdf.pdf
Chapter-4-Plane-Wave-Propagation-pdf.pdf
ShamsAli42
Visionaize for Visionaize AI Powered Solution For Thermal Power Plant.pptx
Visionaize  for Visionaize AI Powered Solution For Thermal Power Plant.pptxVisionaize  for Visionaize AI Powered Solution For Thermal Power Plant.pptx
Visionaize for Visionaize AI Powered Solution For Thermal Power Plant.pptx
SumantaBasu12
7. PHP and gaghhgashgfsgajhfkhshfasMySQL.pptx
7. PHP and gaghhgashgfsgajhfkhshfasMySQL.pptx7. PHP and gaghhgashgfsgajhfkhshfasMySQL.pptx
7. PHP and gaghhgashgfsgajhfkhshfasMySQL.pptx
berihun18
PPTjhjhghhhghghghggvgfggffgftftftftftft.ppt
PPTjhjhghhhghghghggvgfggffgftftftftftft.pptPPTjhjhghhhghghghggvgfggffgftftftftftft.ppt
PPTjhjhghhhghghghggvgfggffgftftftftftft.ppt
vmanjusundertamil21
CPT OPT FEB 2025 TENNEY_Jamespptx university
CPT OPT FEB 2025 TENNEY_Jamespptx universityCPT OPT FEB 2025 TENNEY_Jamespptx university
CPT OPT FEB 2025 TENNEY_Jamespptx university
gobindsingh1107
PPT_OOSE software engineering data .pptx
PPT_OOSE software engineering data .pptxPPT_OOSE software engineering data .pptx
PPT_OOSE software engineering data .pptx
ssuser2d043c
This presentation detail concepts of cryptocurrency
This presentation detail concepts of cryptocurrencyThis presentation detail concepts of cryptocurrency
This presentation detail concepts of cryptocurrency
Aslbtr
Data-Ethics-and-Privacy-What-Every-Analyst-Should-Know
Data-Ethics-and-Privacy-What-Every-Analyst-Should-KnowData-Ethics-and-Privacy-What-Every-Analyst-Should-Know
Data-Ethics-and-Privacy-What-Every-Analyst-Should-Know
Ozias Rondon
Information Security Management-Planning 1.pptx
Information Security Management-Planning 1.pptxInformation Security Management-Planning 1.pptx
Information Security Management-Planning 1.pptx
FrancisFayiah
The rise of AI Agents - Beyond Automation_ The Rise of AI Agents in Service ...
The rise of AI Agents -  Beyond Automation_ The Rise of AI Agents in Service ...The rise of AI Agents -  Beyond Automation_ The Rise of AI Agents in Service ...
The rise of AI Agents - Beyond Automation_ The Rise of AI Agents in Service ...
Yasen Lilov
brightonSEO - Metehan Yesilyurt - Generative AI & GEO: the new SEO race and h...
brightonSEO - Metehan Yesilyurt - Generative AI & GEO: the new SEO race and h...brightonSEO - Metehan Yesilyurt - Generative AI & GEO: the new SEO race and h...
brightonSEO - Metehan Yesilyurt - Generative AI & GEO: the new SEO race and h...
Metehan Yeilyurt

1_Introduction.pptx

  • 1. Introduction to Algorithm Design Rangaballav Pradhan Asst. Professor, Dept. of CSE, ITER, SOA Deemed to be University
  • 2. Introducing Algorithms What is an Algorithm? Computer Computing/ Data Processing Complex Operations Programming Language A program A Problem An Algorithm A solution
  • 3. Definition An algorithm is a finite sequence of basic and well-defined instructions for solving a class of problems or to perform a specific computation.
  • 4. Characteristics of algorithms Input 0 Output 1 Finiteness Definiteness Effectiveness Correctness Efficiency
  • 5. Process of problem solving Define the problem (specifications, input and constraints) Develop a model using problem specifications and constraints Define the specification of an algorithm Design an algorithm using a suitable design approach Verify the correctness of the algorithm Analysis of the algorithm Implement the algorithm Program testing Documentation or publish the algorithm
  • 6. Significance of algorithms To find the solutions for complex computational problems To improve the efficiency of a computer program Proper utilization of computing resources To handle the processing of larger problem instances efficiently
  • 7. Example: GCD of two numbers The greatest common divisor (GCD) of two or more integers, which are not all zero, is the largest positive integer that divides each of the integers. For example, the GCD of 8 and 12 is 4, that is, gcd(8,12)=4. Method 1: Using prime factorizations: gcd (48, 120) 48 = 2 x 2 x 2 x 2 x 3 120 = 2 x 2 x 2 x 3 x 5 Gcd = 2 x 2 x 2 x 3 =24 gcd (a,b) 1. Factorize a using prime factors 2. Factorize b using prime factors 3. Find the common prime factors of a and b 4. Multiply the common prime factors
  • 8. Begin if a = 0 OR b = 0, then return 0 if a = b, then return b if a > b, then return findGCD(a-b, b) else return findGCD(a, b-a) End Method 2: Euclidian Algorithm 1 Example: gcd (48, 120) gcd (48, 120-48) gcd (48, 72) gcd (48, 72-48) gcd (48, 24) gcd (24, 24) return 24 gcd = 24
  • 9. If A = 0 then GCD(a, b) = b If b = 0 then GCD(a, b) = a GCD(a, b) = GCD(b, a % b) Method 3: Euclidian Algorithm 2 Example: gcd (48, 120) gcd (120, 48) gcd (48, 24) gcd (24, 0) gcd = 24
  • 10. English-like: Using some natural language to explain the steps Flowchart: Using diagrammatic representation of the steps Pseudocode: Using natural language, symbolic abbreviations and mathematical notations to write a programming language like structure but not exactly a program. Algorithm Writing Formats for i <- 1 to length(A) x <- A[i] j <- i while j > 0 and A[j-1] > x A[j] <- A[j-1] j <- j - 1 A[j] <- x
  • 12. The problem definition that is to be solved by the algorithm. The constraints of the problem that must be considered while solving the problem. The input to be taken to solve the problem instance. The output to be expected when the problem is solved. The design approach to be followed. Algorithm Design: Pre-requisites
  • 13. Various design approaches exist: 1. Brute force 2. Divide and conquer 3. Greedy algorithm 4. Dynamic programming 5. Backtracking algorithm 6. Branch and Bound Algorithm Design: Formulation/Definition
  • 14. Recursive vs Iterative: A recursive algorithm calls itself again and again until a base condition is met whereas iterative algorithms use loops to solve any problem. Exact vs Approximate: Algorithms that are capable of finding an exact optimal solution for a problem are known as the exact algorithm. For some problems, it is not possible to find the most optimized solution. In such cases an approximation algorithm is used that finds an approximate solution to a problem which may not be optimal but is near optimal. Serial vs Parallel vs Distributed: In serial algorithms, one instruction is executed at a time while parallel algorithms divide the problem into subproblems and execute them on different processors. If parallel algorithms are distributed on different machines over a network, then they are known as distributed algorithms. Algorithm Design: Testing/Implementation
  • 15. Analysis refers to the computation of complexity of a given algorithm Analysis gives a measure of efficiency of the algorithm in terms of resource consumption Mainly two parameters are considered for analysis of algorithms: the amount of running time and the memory space. The running time of an algorithm is expressed as a function of the input size and is known as time complexity and the volume of memory space consumed is known as space complexity. Analysis of Algorithm
  • 16. Priori Analysis: A priori analysis means checking the algorithm before its implementation. In this, the algorithm is checked when it is written in the form of theoretical steps. This Efficiency of an algorithm is measured by assuming that all other factors, for example, processor speed, are constant and have no effect on the implementation. It is in this method, that the Algorithm Complexity is determined. Posterior Analysis: A posterior analysis means checking the algorithm after its implementation. In this, the algorithm is checked by implementing it in any programming language and executing it. This analysis helps to get the actual and real analysis report about correctness, space required, time consumed etc. Analysis of Algorithm