SlideShare a Scribd company logo
The Design and
Analysis of
Algorithms
by Anany Levitin
2
CHAPTER 2:CHAPTER 2: Fundamentals of the
Analysis of Algorithm Efficiency
 The Analysis Framework
 Asymptotic Notations and Basic Efficiency Classes
 Mathematical Analysis of Nonrecursive Algorithms
 Mathematical Analysis of Recursive Algorithms
 Empirical Analysis of Algorithms
 Algorithm Visualization
3
Analysis of Algorithm Efficiency
 Two kinds of efficiency:
Time efficiency
Space efficiency
 Time efficiency - Time complexity
How fast an algorithm in question runs.
 Space efficiency - Space complexity
The amount of memory units required by the
algorithm in addition to the space needed for its
input and output.
4
The Analysis Framework
 Measuring an Input’s Size
 Units for Measuring Running Time
 Orders of Growth
 Worst-Case, Best-Case, and Average-
Case Efficiencies
5
Measuring an Input’s Size
6
Measuring an Input’s Size
7
Measuring an Input’s Size
 Almost all algorithms run longer on larger
inputs
 It is logical to investigate an algorithm’s
efficiency as a function of some parameter n
indicating the algorithm’s input size
 Examples:
 Searching/ Finding Smallest or largest
 Evaluating Polynomial Equation
 Matrix Manipulation
 Spell Checking
 Primality Testing 8
Units for Measuring Running Time
 Concerns with units for measurement of an
algorithm’s running time
 Standard unit of time measurement—a second, or
millisecond cannot be used
 Reasons:
 Dependence on the speed of a particular computer
 Dependence on the quality of a program implementing
the algorithm
 Depends on the compiler used in generating the
machine code
 Difficulty of clocking the actual running time of the
program
9
 Solution:
Identify the most important operation of
the algorithm, called the basic operation
in an algorithm
10
Units for Measuring Running Time
 Basic Operation
 It is the operation contributing the most to the total
running time of an algorithm
 It is the most time consuming operation in the
algorithm’s innermost loop
 Example:
 Sorting - comparing elements (keys)
Mathematical problems – all four arithmetical
operations
11
Units for Measuring Running Time
 Analysis of an algorithm’s time efficiency
suggests measuring it by counting the number
of times the algorithm’s basic operation is
executed on inputs of size n.
 Answer Questions Like:
 How much faster would this algorithm run on a
machine that is 10 times faster than the one we have?
 How much longer the algorithm will take if the size of
the input is doubled?
12
Units for Measuring Running Time
Orders of Growth
 Smaller inputs are not considered in calculating the
efficiency of an algorithm
 A difference in running time of very large inputs really
distinguish an efficient algorithm from an inefficient
one
 Magnitude of the input has a profound significance for
the analysis
13
14
Orders of Growth with input size ‘n’
Worst-Case, Best-Case & Average-Case
Efficiencies
 There are many algorithms for which running
time depends not only on an input size but
also on the specifics of a particular input.
15
Best-case efficiency
 The best-case efficiency of an
algorithm is its efficiency for the best-
case input of size n, which is an input (or
inputs) of size n for which the algorithm
runs the fastest among all possible inputs
of that size.
16
Worst-case efficiency
 The worst-case efficiency of an
algorithm is its efficiency for the worst-
case input of size n, which is an input (or
inputs) of size n for which the algorithm
runs the longest among all possible inputs
of that size.
17
Average-case efficiency
 The average-case efficiency cannot be
obtained by taking the average of the
worst-case and the best-case efficiencies.
18
Amortized Efficiency
 It applies not to a single run of an
algorithm but rather to a sequence of
operations performed on the same data
structure.
19
Recapitulation of the Analysis
Framework
 Input size
 Time efficiency is measured by counting
the number of times the algorithm’s
 basic operation is executed. Space
efficiency is measured by counting the
 number of extra memory units consumed
by the algorithm
20
 The efficiencies of some algorithms may
differ significantly for inputs of the
 same size. For such algorithms, we need
to distinguish between the worst-case,
 average-case, and best-case efficiencies.
 The framework’s primary interest lies in
the order of growth of the algorithm’s
 running time (extra memory units
consumed) as its input size goes to
infinity.
21
Have a SPLENDID Day..!!!
22

More Related Content

What's hot

Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithms
Jothi Thilaga P
 
Algorithmic problem solving
Algorithmic problem solvingAlgorithmic problem solving
Algorithmic problem solving
Prabhakaran V M
 
Python algorithm efficency
Python algorithm efficencyPython algorithm efficency
Python algorithm efficency
ToniyaP1
 
Lecture 2 role of algorithms in computing
Lecture 2   role of algorithms in computingLecture 2   role of algorithms in computing
Lecture 2 role of algorithms in computing
jayavignesh86
 
Analysis and Algorithms: basic Introduction
Analysis and Algorithms: basic IntroductionAnalysis and Algorithms: basic Introduction
Analysis and Algorithms: basic Introduction
ssuseraf8b2f
 
Lec 2 algorithms efficiency complexity
Lec 2 algorithms efficiency  complexityLec 2 algorithms efficiency  complexity
Lec 2 algorithms efficiency complexity
Anaya Zafar
 
chapter 1
chapter 1chapter 1
chapter 1
yatheesha
 
Unit i basic concepts of algorithms
Unit i basic concepts of algorithmsUnit i basic concepts of algorithms
Unit i basic concepts of algorithms
sangeetha s
 
Analysis algorithm
Analysis algorithmAnalysis algorithm
Analysis algorithm
renukarenuka9
 
Model and Design
Model and Design Model and Design
Model and Design
Dr Shashikant Athawale
 
Algorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms IAlgorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms I
Mohamed Loey
 
#1 designandanalysis of algo
#1 designandanalysis of algo#1 designandanalysis of algo
#1 designandanalysis of algo
Brijida Charizma Ardoña-Navarro
 
Algorithm Introduction
Algorithm IntroductionAlgorithm Introduction
Algorithm Introduction
Ashim Lamichhane
 
Algorithm analysis
Algorithm analysisAlgorithm analysis
Algorithm analysis
sumitbardhan
 
Day 2 Chapter 1 Unit 1
Day 2 Chapter 1 Unit 1Day 2 Chapter 1 Unit 1
Complexity Analysis
Complexity Analysis Complexity Analysis
Complexity Analysis
Shaista Qadir
 
Data structures algorithms basics
Data structures   algorithms basicsData structures   algorithms basics
Data structures algorithms basics
ayeshasafdar8
 
Daa notes 1
Daa notes 1Daa notes 1
Daa notes 1
smruti sarangi
 
Algorithm Design Presentation
Algorithm Design PresentationAlgorithm Design Presentation
Algorithm Design Presentation
Kawsar Ahmed
 
Our presentation on algorithm design
Our presentation on algorithm designOur presentation on algorithm design
Our presentation on algorithm design
Nahid Hasan
 

What's hot (20)

Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithms
 
Algorithmic problem solving
Algorithmic problem solvingAlgorithmic problem solving
Algorithmic problem solving
 
Python algorithm efficency
Python algorithm efficencyPython algorithm efficency
Python algorithm efficency
 
Lecture 2 role of algorithms in computing
Lecture 2   role of algorithms in computingLecture 2   role of algorithms in computing
Lecture 2 role of algorithms in computing
 
Analysis and Algorithms: basic Introduction
Analysis and Algorithms: basic IntroductionAnalysis and Algorithms: basic Introduction
Analysis and Algorithms: basic Introduction
 
Lec 2 algorithms efficiency complexity
Lec 2 algorithms efficiency  complexityLec 2 algorithms efficiency  complexity
Lec 2 algorithms efficiency complexity
 
chapter 1
chapter 1chapter 1
chapter 1
 
Unit i basic concepts of algorithms
Unit i basic concepts of algorithmsUnit i basic concepts of algorithms
Unit i basic concepts of algorithms
 
Analysis algorithm
Analysis algorithmAnalysis algorithm
Analysis algorithm
 
Model and Design
Model and Design Model and Design
Model and Design
 
Algorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms IAlgorithms Lecture 2: Analysis of Algorithms I
Algorithms Lecture 2: Analysis of Algorithms I
 
#1 designandanalysis of algo
#1 designandanalysis of algo#1 designandanalysis of algo
#1 designandanalysis of algo
 
Algorithm Introduction
Algorithm IntroductionAlgorithm Introduction
Algorithm Introduction
 
Algorithm analysis
Algorithm analysisAlgorithm analysis
Algorithm analysis
 
Day 2 Chapter 1 Unit 1
Day 2 Chapter 1 Unit 1Day 2 Chapter 1 Unit 1
Day 2 Chapter 1 Unit 1
 
Complexity Analysis
Complexity Analysis Complexity Analysis
Complexity Analysis
 
Data structures algorithms basics
Data structures   algorithms basicsData structures   algorithms basics
Data structures algorithms basics
 
Daa notes 1
Daa notes 1Daa notes 1
Daa notes 1
 
Algorithm Design Presentation
Algorithm Design PresentationAlgorithm Design Presentation
Algorithm Design Presentation
 
Our presentation on algorithm design
Our presentation on algorithm designOur presentation on algorithm design
Our presentation on algorithm design
 

Similar to Day 3 chapter 2 unit 1

Algorithm Analysis.pdf
Algorithm Analysis.pdfAlgorithm Analysis.pdf
Algorithm Analysis.pdf
MemMem25
 
Algorithms Analysis.pdf
Algorithms Analysis.pdfAlgorithms Analysis.pdf
Algorithms Analysis.pdf
ShaistaRiaz4
 
Slides [DAA] Unit 2 Ch 2.pdf
Slides [DAA] Unit 2 Ch 2.pdfSlides [DAA] Unit 2 Ch 2.pdf
Slides [DAA] Unit 2 Ch 2.pdf
Vijayraj799513
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and Algorithm
Dhaval Kaneria
 
Cupdf.com introduction to-data-structures-and-algorithm
Cupdf.com introduction to-data-structures-and-algorithmCupdf.com introduction to-data-structures-and-algorithm
Cupdf.com introduction to-data-structures-and-algorithm
TarikuDabala1
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and Algorithm
Dhaval Kaneria
 
Python algorithm
Python algorithmPython algorithm
Python algorithm
Prof. Dr. K. Adisesha
 
Chapter 1 Data structure.pptx
Chapter 1 Data structure.pptxChapter 1 Data structure.pptx
Chapter 1 Data structure.pptx
wondmhunegn
 
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...
AntareepMajumder
 
Algorithm Analysis.pdf
Algorithm Analysis.pdfAlgorithm Analysis.pdf
Algorithm Analysis.pdf
NayanChandak1
 
Fundamentals of the Analysis of Algorithm Efficiency
Fundamentals of the Analysis of Algorithm EfficiencyFundamentals of the Analysis of Algorithm Efficiency
Fundamentals of the Analysis of Algorithm Efficiency
Saranya Natarajan
 
Data Structure and Algorithm chapter two, This material is for Data Structure...
Data Structure and Algorithm chapter two, This material is for Data Structure...Data Structure and Algorithm chapter two, This material is for Data Structure...
Data Structure and Algorithm chapter two, This material is for Data Structure...
bekidea
 
unit 2 hpc.pptx
unit 2 hpc.pptxunit 2 hpc.pptx
unit 2 hpc.pptx
gopal467344
 
Daa presentation 97
Daa presentation 97Daa presentation 97
Daa presentation 97
Garima Verma
 
Data Structures and Algorithms Unit 01
Data Structures and Algorithms Unit 01Data Structures and Algorithms Unit 01
Data Structures and Algorithms Unit 01
Prashanth Shivakumar
 
DA lecture 3.pptx
DA lecture 3.pptxDA lecture 3.pptx
DA lecture 3.pptx
SayanSen36
 
Unit 1, ADA.pptx
Unit 1, ADA.pptxUnit 1, ADA.pptx
Unit 1, ADA.pptx
jinkhatima
 
daa unit 1.pptx
daa unit 1.pptxdaa unit 1.pptx
daa unit 1.pptx
LakshayYadav46
 
Algorithm - Introduction
Algorithm - IntroductionAlgorithm - Introduction
Algorithm - Introduction
Madhu Bala
 
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 Day 3 chapter 2 unit 1 (20)

Algorithm Analysis.pdf
Algorithm Analysis.pdfAlgorithm Analysis.pdf
Algorithm Analysis.pdf
 
Algorithms Analysis.pdf
Algorithms Analysis.pdfAlgorithms Analysis.pdf
Algorithms Analysis.pdf
 
Slides [DAA] Unit 2 Ch 2.pdf
Slides [DAA] Unit 2 Ch 2.pdfSlides [DAA] Unit 2 Ch 2.pdf
Slides [DAA] Unit 2 Ch 2.pdf
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and Algorithm
 
Cupdf.com introduction to-data-structures-and-algorithm
Cupdf.com introduction to-data-structures-and-algorithmCupdf.com introduction to-data-structures-and-algorithm
Cupdf.com introduction to-data-structures-and-algorithm
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and Algorithm
 
Python algorithm
Python algorithmPython algorithm
Python algorithm
 
Chapter 1 Data structure.pptx
Chapter 1 Data structure.pptxChapter 1 Data structure.pptx
Chapter 1 Data structure.pptx
 
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_I_25-07-2022_Fu...
 
Algorithm Analysis.pdf
Algorithm Analysis.pdfAlgorithm Analysis.pdf
Algorithm Analysis.pdf
 
Fundamentals of the Analysis of Algorithm Efficiency
Fundamentals of the Analysis of Algorithm EfficiencyFundamentals of the Analysis of Algorithm Efficiency
Fundamentals of the Analysis of Algorithm Efficiency
 
Data Structure and Algorithm chapter two, This material is for Data Structure...
Data Structure and Algorithm chapter two, This material is for Data Structure...Data Structure and Algorithm chapter two, This material is for Data Structure...
Data Structure and Algorithm chapter two, This material is for Data Structure...
 
unit 2 hpc.pptx
unit 2 hpc.pptxunit 2 hpc.pptx
unit 2 hpc.pptx
 
Daa presentation 97
Daa presentation 97Daa presentation 97
Daa presentation 97
 
Data Structures and Algorithms Unit 01
Data Structures and Algorithms Unit 01Data Structures and Algorithms Unit 01
Data Structures and Algorithms Unit 01
 
DA lecture 3.pptx
DA lecture 3.pptxDA lecture 3.pptx
DA lecture 3.pptx
 
Unit 1, ADA.pptx
Unit 1, ADA.pptxUnit 1, ADA.pptx
Unit 1, ADA.pptx
 
daa unit 1.pptx
daa unit 1.pptxdaa unit 1.pptx
daa unit 1.pptx
 
Algorithm - Introduction
Algorithm - IntroductionAlgorithm - Introduction
Algorithm - Introduction
 
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 P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai

TestFile
TestFileTestFile
3.1 Trees ( Introduction, Binary Trees & Binary Search Trees)
3.1 Trees ( Introduction, Binary Trees & Binary Search Trees)3.1 Trees ( Introduction, Binary Trees & Binary Search Trees)
3.1 Trees ( Introduction, Binary Trees & Binary Search Trees)
P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai
 
2.1 STACK & QUEUE ADTS
2.1 STACK & QUEUE ADTS2.1 STACK & QUEUE ADTS
2.2 stack applications Infix to Postfix & Evaluation of Post Fix
2.2 stack applications Infix to Postfix & Evaluation of Post Fix2.2 stack applications Infix to Postfix & Evaluation of Post Fix
2.2 stack applications Infix to Postfix & Evaluation of Post Fix
P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai
 
1. 6 doubly linked list
1. 6 doubly linked list1. 6 doubly linked list
1. 5 Circular singly linked list
1. 5 Circular singly linked list1. 5 Circular singly linked list
1. 4 Singly linked list deletion
1. 4 Singly linked list deletion1. 4 Singly linked list deletion
1. 3 singly linked list insertion 2
1. 3 singly linked list   insertion 21. 3 singly linked list   insertion 2
1. 2 Singly Linked List
1. 2 Singly Linked List1. 2 Singly Linked List
1. C Basics for Data Structures Bridge Course
1. C Basics for Data Structures   Bridge Course1. C Basics for Data Structures   Bridge Course
Approximation Algorithms TSP
Approximation Algorithms   TSPApproximation Algorithms   TSP
Optimal binary search tree dynamic programming
Optimal binary search tree   dynamic programmingOptimal binary search tree   dynamic programming
The stable marriage problem iterative improvement method
The stable marriage problem iterative improvement methodThe stable marriage problem iterative improvement method
The stable marriage problem iterative improvement method
P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai
 
Maximum matching in bipartite graphs iterative improvement method
Maximum matching in bipartite graphs   iterative improvement methodMaximum matching in bipartite graphs   iterative improvement method
Maximum matching in bipartite graphs iterative improvement method
P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai
 
Knapsack dynamic programming formula top down (1)
Knapsack dynamic programming formula top down (1)Knapsack dynamic programming formula top down (1)
Knapsack dynamic programming formula top down (1)
P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai
 
Knapsack dynamic programming formula bottom up
Knapsack dynamic programming formula bottom upKnapsack dynamic programming formula bottom up
Huffman tree coding greedy approach
Huffman tree coding  greedy approachHuffman tree coding  greedy approach
Simplex method
Simplex methodSimplex method
Simplex method
Simplex methodSimplex method
Multiplication of integers & strassens matrix multiplication subi notes
Multiplication of integers & strassens matrix multiplication   subi notesMultiplication of integers & strassens matrix multiplication   subi notes
Multiplication of integers & strassens matrix multiplication subi notes
P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai
 

More from P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai (20)

TestFile
TestFileTestFile
TestFile
 
3.1 Trees ( Introduction, Binary Trees & Binary Search Trees)
3.1 Trees ( Introduction, Binary Trees & Binary Search Trees)3.1 Trees ( Introduction, Binary Trees & Binary Search Trees)
3.1 Trees ( Introduction, Binary Trees & Binary Search Trees)
 
2.1 STACK & QUEUE ADTS
2.1 STACK & QUEUE ADTS2.1 STACK & QUEUE ADTS
2.1 STACK & QUEUE ADTS
 
2.2 stack applications Infix to Postfix & Evaluation of Post Fix
2.2 stack applications Infix to Postfix & Evaluation of Post Fix2.2 stack applications Infix to Postfix & Evaluation of Post Fix
2.2 stack applications Infix to Postfix & Evaluation of Post Fix
 
1. 6 doubly linked list
1. 6 doubly linked list1. 6 doubly linked list
1. 6 doubly linked list
 
1. 5 Circular singly linked list
1. 5 Circular singly linked list1. 5 Circular singly linked list
1. 5 Circular singly linked list
 
1. 4 Singly linked list deletion
1. 4 Singly linked list deletion1. 4 Singly linked list deletion
1. 4 Singly linked list deletion
 
1. 3 singly linked list insertion 2
1. 3 singly linked list   insertion 21. 3 singly linked list   insertion 2
1. 3 singly linked list insertion 2
 
1. 2 Singly Linked List
1. 2 Singly Linked List1. 2 Singly Linked List
1. 2 Singly Linked List
 
1. C Basics for Data Structures Bridge Course
1. C Basics for Data Structures   Bridge Course1. C Basics for Data Structures   Bridge Course
1. C Basics for Data Structures Bridge Course
 
Approximation Algorithms TSP
Approximation Algorithms   TSPApproximation Algorithms   TSP
Approximation Algorithms TSP
 
Optimal binary search tree dynamic programming
Optimal binary search tree   dynamic programmingOptimal binary search tree   dynamic programming
Optimal binary search tree dynamic programming
 
The stable marriage problem iterative improvement method
The stable marriage problem iterative improvement methodThe stable marriage problem iterative improvement method
The stable marriage problem iterative improvement method
 
Maximum matching in bipartite graphs iterative improvement method
Maximum matching in bipartite graphs   iterative improvement methodMaximum matching in bipartite graphs   iterative improvement method
Maximum matching in bipartite graphs iterative improvement method
 
Knapsack dynamic programming formula top down (1)
Knapsack dynamic programming formula top down (1)Knapsack dynamic programming formula top down (1)
Knapsack dynamic programming formula top down (1)
 
Knapsack dynamic programming formula bottom up
Knapsack dynamic programming formula bottom upKnapsack dynamic programming formula bottom up
Knapsack dynamic programming formula bottom up
 
Huffman tree coding greedy approach
Huffman tree coding  greedy approachHuffman tree coding  greedy approach
Huffman tree coding greedy approach
 
Simplex method
Simplex methodSimplex method
Simplex method
 
Simplex method
Simplex methodSimplex method
Simplex method
 
Multiplication of integers & strassens matrix multiplication subi notes
Multiplication of integers & strassens matrix multiplication   subi notesMultiplication of integers & strassens matrix multiplication   subi notes
Multiplication of integers & strassens matrix multiplication subi notes
 

Recently uploaded

Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
heavyhaig
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
Exception Handling notes in java exception
Exception Handling notes in java exceptionException Handling notes in java exception
Exception Handling notes in java exception
Ratnakar Mikkili
 
Low power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniquesLow power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniques
nooriasukmaningtyas
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
ssuser36d3051
 
2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt
PuktoonEngr
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
Divyam548318
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
mamunhossenbd75
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
awadeshbabu
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
wisnuprabawa3
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
gerogepatton
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
Wearable antenna for antenna applications
Wearable antenna for antenna applicationsWearable antenna for antenna applications
Wearable antenna for antenna applications
Madhumitha Jayaram
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
University of Maribor
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
jpsjournal1
 

Recently uploaded (20)

Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
Exception Handling notes in java exception
Exception Handling notes in java exceptionException Handling notes in java exception
Exception Handling notes in java exception
 
Low power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniquesLow power architecture of logic gates using adiabatic techniques
Low power architecture of logic gates using adiabatic techniques
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
 
2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
Wearable antenna for antenna applications
Wearable antenna for antenna applicationsWearable antenna for antenna applications
Wearable antenna for antenna applications
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
 

Day 3 chapter 2 unit 1

  • 1. The Design and Analysis of Algorithms by Anany Levitin
  • 2. 2 CHAPTER 2:CHAPTER 2: Fundamentals of the Analysis of Algorithm Efficiency  The Analysis Framework  Asymptotic Notations and Basic Efficiency Classes  Mathematical Analysis of Nonrecursive Algorithms  Mathematical Analysis of Recursive Algorithms  Empirical Analysis of Algorithms  Algorithm Visualization
  • 3. 3
  • 4. Analysis of Algorithm Efficiency  Two kinds of efficiency: Time efficiency Space efficiency  Time efficiency - Time complexity How fast an algorithm in question runs.  Space efficiency - Space complexity The amount of memory units required by the algorithm in addition to the space needed for its input and output. 4
  • 5. The Analysis Framework  Measuring an Input’s Size  Units for Measuring Running Time  Orders of Growth  Worst-Case, Best-Case, and Average- Case Efficiencies 5
  • 8. Measuring an Input’s Size  Almost all algorithms run longer on larger inputs  It is logical to investigate an algorithm’s efficiency as a function of some parameter n indicating the algorithm’s input size  Examples:  Searching/ Finding Smallest or largest  Evaluating Polynomial Equation  Matrix Manipulation  Spell Checking  Primality Testing 8
  • 9. Units for Measuring Running Time  Concerns with units for measurement of an algorithm’s running time  Standard unit of time measurement—a second, or millisecond cannot be used  Reasons:  Dependence on the speed of a particular computer  Dependence on the quality of a program implementing the algorithm  Depends on the compiler used in generating the machine code  Difficulty of clocking the actual running time of the program 9
  • 10.  Solution: Identify the most important operation of the algorithm, called the basic operation in an algorithm 10 Units for Measuring Running Time
  • 11.  Basic Operation  It is the operation contributing the most to the total running time of an algorithm  It is the most time consuming operation in the algorithm’s innermost loop  Example:  Sorting - comparing elements (keys) Mathematical problems – all four arithmetical operations 11 Units for Measuring Running Time
  • 12.  Analysis of an algorithm’s time efficiency suggests measuring it by counting the number of times the algorithm’s basic operation is executed on inputs of size n.  Answer Questions Like:  How much faster would this algorithm run on a machine that is 10 times faster than the one we have?  How much longer the algorithm will take if the size of the input is doubled? 12 Units for Measuring Running Time
  • 13. Orders of Growth  Smaller inputs are not considered in calculating the efficiency of an algorithm  A difference in running time of very large inputs really distinguish an efficient algorithm from an inefficient one  Magnitude of the input has a profound significance for the analysis 13
  • 14. 14 Orders of Growth with input size ‘n’
  • 15. Worst-Case, Best-Case & Average-Case Efficiencies  There are many algorithms for which running time depends not only on an input size but also on the specifics of a particular input. 15
  • 16. Best-case efficiency  The best-case efficiency of an algorithm is its efficiency for the best- case input of size n, which is an input (or inputs) of size n for which the algorithm runs the fastest among all possible inputs of that size. 16
  • 17. Worst-case efficiency  The worst-case efficiency of an algorithm is its efficiency for the worst- case input of size n, which is an input (or inputs) of size n for which the algorithm runs the longest among all possible inputs of that size. 17
  • 18. Average-case efficiency  The average-case efficiency cannot be obtained by taking the average of the worst-case and the best-case efficiencies. 18
  • 19. Amortized Efficiency  It applies not to a single run of an algorithm but rather to a sequence of operations performed on the same data structure. 19
  • 20. Recapitulation of the Analysis Framework  Input size  Time efficiency is measured by counting the number of times the algorithm’s  basic operation is executed. Space efficiency is measured by counting the  number of extra memory units consumed by the algorithm 20
  • 21.  The efficiencies of some algorithms may differ significantly for inputs of the  same size. For such algorithms, we need to distinguish between the worst-case,  average-case, and best-case efficiencies.  The framework’s primary interest lies in the order of growth of the algorithm’s  running time (extra memory units consumed) as its input size goes to infinity. 21
  • 22. Have a SPLENDID Day..!!! 22