SlideShare a Scribd company logo
1 of 43
Download to read offline
ASYMPTOTIC NOTATIONS
By
Dr. N. Subhash Chandra
Time Complexity of an Algorithm
The function f(n), gives the running time of an algorithm, depends not only on the size ‘n’ of the input data but also
on the particular data. The complexity function f(n) for certain cases are:
1. Best Case : The minimum possible value of f(n) is called the best case.
2. Average Case : The expected value of f(n).
3. Worst Case : The maximum value of f(n) for any key possible input.
Analysis of Algorithms:
The field of computer science, which studies efficiency of algorithms, is known as analysis of algorithms.
Need of
Asymptotic
notations
Asymptotic
notations
Uses of Notations:
Commonly use notations in performance analysis and
used to characterize the complexity of an algorithm:
• Big–OH (O)
• Big–OMEGA
• Big–THETA ()
Common
Asymptotic
Notations
• Following is a list of some common
asymptotic notations:
• constant − Ο(1)
• logarithmic − Ο(log n)
• Linear − Ο(n)
• n log n − Ο(n log n)
• quadratic − Ο(n2)
• cubic − Ο(n3)
• Polynomial − Ο(n1)
• exponential − Ο(2n)
Practical
complexities:
Rate of Growth
function
Analysis of
Algorithms
Analyzing Algorithms
Suppose ‘M’ is an algorithm, and suppose ‘n’ is the size of the input data. Clearly the
complexity f(n) of M increases as n increases. It is usually the rate of increase of f(n)
we want to examine. This is usually done by comparing f(n) with some standard
functions. The most common computing times are:
O(1), O(log2 n), O(n), O(n. log2 n), O(n2
), O(n3
), O(2n
), n! and nn
Example on Big OH notation
Problems
Example on Big OMEGA notation
Problems
Problems
Problems on Asymptotic Notations
Problems on
Asymptotic
Notations
Practical
complexities:
Graph for
inputs and
Time
Plot
• Example 1:
•
• Analysis for nested for loop
• Now let’s look at a more complicated
example, a nested for loop:
• for (i = 1; i<=n; i++)
• for (j = 1; j<=n; j++)
• a[i,j] = b[i,j] * x;
• Analysis of matrix multiply
• Lets start with an easy case. Multiplying two n
n matrices.
• The code to compute the matrix product C = A
* B is given below.
•
• for (i = 1; i<=n; i++)
• for (j = 1; j<=n; j++) C[i, j] = 0;
• for (k = 1; k<=n; k++)
• C[i, j] = C[i, j] + A[i, k]
* B[k, j];
• Analysis of matrix multiply
•
• Lets start with an easy case. Multiplying two n n matrices. The code
to compute the matrix product C = A * B is given below.
• for (i = 1; i<=n; i++)
• for (j = 1; j<=n; j++) C[i, j] = 0;
• for (k = 1; k<=n; k++)
• C[i, j] = C[i, j] + A[i, k] * B[k, j];
•
• Analysis of bubble sort
• The main body of the code for bubble sort looks something like this:
•
• for (i = n-1; i<1; i--)
• for (j = 1; j<=i; j++)
• if (a[j] > a[j+1])
• swap a[j] and a[j+1];
General rules for the analysis of
programs
• The running time of each assignment read and write statement can usually be
taken to be O(1).
• The largest running time of any statement in the sequence.
• The time to execute a loop is the sum, over all times around the loop, the time to
execute the body and the time to evaluate the condition for termination
• The running time of an if-statement is the cost of conditionally executed
statements, plus the time for evaluating the condition. The time to evaluate the
condition is normally O(1)
General rules for the analysis of
programs
• Analyse for worst case scenario .
• Rule 1: For large polynomial, Drop Lower order term, Drop Constant multiplier.
• Rule 2: Total running time equal to sum of running time of all segments.
• Rule 3: For Conditional statement , Pick complexity of condition which is worst case
• Rule 4: The time hierarchy of complexities
• O(1)<O(logn)<O(n)<O(nlogn) <O(n2) <O(n!)--- O(2n)
Properties of
asymptotic notations
Properties of
asymptotic notations
Properties of asymptotic notations
Properties of asymptotic
notations

More Related Content

What's hot

Introduction to datastructure and algorithm
Introduction to datastructure and algorithmIntroduction to datastructure and algorithm
Introduction to datastructure and algorithmPratik Mota
 
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 EfficiencySaranya Natarajan
 
Basic terminologies & asymptotic notations
Basic terminologies & asymptotic notationsBasic terminologies & asymptotic notations
Basic terminologies & asymptotic notationsRajendran
 
2 chapter2 algorithm_analysispart1
2 chapter2 algorithm_analysispart12 chapter2 algorithm_analysispart1
2 chapter2 algorithm_analysispart1SSE_AndyLi
 
Data Structure and Algorithms
Data Structure and Algorithms Data Structure and Algorithms
Data Structure and Algorithms ManishPrajapati78
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)swapnac12
 
Lecture 3 insertion sort and complexity analysis
Lecture 3   insertion sort and complexity analysisLecture 3   insertion sort and complexity analysis
Lecture 3 insertion sort and complexity analysisjayavignesh86
 
Algorithm Analyzing
Algorithm AnalyzingAlgorithm Analyzing
Algorithm AnalyzingHaluan Irsad
 
Algorithm analysis
Algorithm analysisAlgorithm analysis
Algorithm analysissumitbardhan
 
Data Structures and Algorithm Analysis
Data Structures  and  Algorithm AnalysisData Structures  and  Algorithm Analysis
Data Structures and Algorithm AnalysisMary Margarat
 
02 order of growth
02 order of growth02 order of growth
02 order of growthHira Gul
 
Algorithm in Computer, Sorting and Notations
Algorithm in Computer, Sorting  and NotationsAlgorithm in Computer, Sorting  and Notations
Algorithm in Computer, Sorting and NotationsAbid Kohistani
 
Asymptotic notations(Big O, Omega, Theta )
Asymptotic notations(Big O, Omega, Theta )Asymptotic notations(Big O, Omega, Theta )
Asymptotic notations(Big O, Omega, Theta )swapnac12
 
Asymptotic analysis
Asymptotic analysisAsymptotic analysis
Asymptotic analysisSoujanya V
 
Algorithms lecture 3
Algorithms lecture 3Algorithms lecture 3
Algorithms lecture 3Mimi Haque
 

What's hot (20)

Introduction to datastructure and algorithm
Introduction to datastructure and algorithmIntroduction to datastructure and algorithm
Introduction to datastructure and algorithm
 
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
 
Basic terminologies & asymptotic notations
Basic terminologies & asymptotic notationsBasic terminologies & asymptotic notations
Basic terminologies & asymptotic notations
 
Algorithm big o
Algorithm big oAlgorithm big o
Algorithm big o
 
2 chapter2 algorithm_analysispart1
2 chapter2 algorithm_analysispart12 chapter2 algorithm_analysispart1
2 chapter2 algorithm_analysispart1
 
Data Structure and Algorithms
Data Structure and Algorithms Data Structure and Algorithms
Data Structure and Algorithms
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)
 
Lecture 3 insertion sort and complexity analysis
Lecture 3   insertion sort and complexity analysisLecture 3   insertion sort and complexity analysis
Lecture 3 insertion sort and complexity analysis
 
Lec7
Lec7Lec7
Lec7
 
Algorithm Analyzing
Algorithm AnalyzingAlgorithm Analyzing
Algorithm Analyzing
 
Algorithm analysis
Algorithm analysisAlgorithm analysis
Algorithm analysis
 
Data Structures and Algorithm Analysis
Data Structures  and  Algorithm AnalysisData Structures  and  Algorithm Analysis
Data Structures and Algorithm Analysis
 
02 order of growth
02 order of growth02 order of growth
02 order of growth
 
Best,worst,average case .17581556 045
Best,worst,average case .17581556 045Best,worst,average case .17581556 045
Best,worst,average case .17581556 045
 
Algorithm in Computer, Sorting and Notations
Algorithm in Computer, Sorting  and NotationsAlgorithm in Computer, Sorting  and Notations
Algorithm in Computer, Sorting and Notations
 
Unit ii algorithm
Unit   ii algorithmUnit   ii algorithm
Unit ii algorithm
 
Asymptotic notations(Big O, Omega, Theta )
Asymptotic notations(Big O, Omega, Theta )Asymptotic notations(Big O, Omega, Theta )
Asymptotic notations(Big O, Omega, Theta )
 
Asymptotic analysis
Asymptotic analysisAsymptotic analysis
Asymptotic analysis
 
Algorithms lecture 3
Algorithms lecture 3Algorithms lecture 3
Algorithms lecture 3
 
Complexity of Algorithm
Complexity of AlgorithmComplexity of Algorithm
Complexity of Algorithm
 

Similar to Asymptotic notations

Algorithms & Complexity Calculation
Algorithms & Complexity CalculationAlgorithms & Complexity Calculation
Algorithms & Complexity CalculationAkhil Kaushik
 
2. Asymptotic Notations and Complexity Analysis.pptx
2. Asymptotic Notations and Complexity Analysis.pptx2. Asymptotic Notations and Complexity Analysis.pptx
2. Asymptotic Notations and Complexity Analysis.pptxRams715121
 
DAA-Unit1.pptx
DAA-Unit1.pptxDAA-Unit1.pptx
DAA-Unit1.pptxNishaS88
 
Chapter One.pdf
Chapter One.pdfChapter One.pdf
Chapter One.pdfabay golla
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithmsiqbalphy1
 
Asymptotic Notations
Asymptotic NotationsAsymptotic Notations
Asymptotic NotationsRishabh Soni
 
Asymptotic Notations.pptx
Asymptotic Notations.pptxAsymptotic Notations.pptx
Asymptotic Notations.pptxSunilWork1
 
18103010 algorithm complexity (iterative)
18103010 algorithm complexity (iterative)18103010 algorithm complexity (iterative)
18103010 algorithm complexity (iterative)AdityaKhandelwal58
 
Asymptotics 140510003721-phpapp02
Asymptotics 140510003721-phpapp02Asymptotics 140510003721-phpapp02
Asymptotics 140510003721-phpapp02mansab MIRZA
 
Time_Complexity.pptx
Time_Complexity.pptxTime_Complexity.pptx
Time_Complexity.pptxvivekcommon
 
Ch1. Analysis of Algorithms.pdf
Ch1. Analysis of Algorithms.pdfCh1. Analysis of Algorithms.pdf
Ch1. Analysis of Algorithms.pdfzoric99
 
Analysis and Algorithms: basic Introduction
Analysis and Algorithms: basic IntroductionAnalysis and Algorithms: basic Introduction
Analysis and Algorithms: basic Introductionssuseraf8b2f
 
Data Structures- Part2 analysis tools
Data Structures- Part2 analysis toolsData Structures- Part2 analysis tools
Data Structures- Part2 analysis toolsAbdullah Al-hazmy
 
algorithmanalysis and effciency.pptx
algorithmanalysis and effciency.pptxalgorithmanalysis and effciency.pptx
algorithmanalysis and effciency.pptxChSreenivasuluReddy
 

Similar to Asymptotic notations (20)

Algorithms & Complexity Calculation
Algorithms & Complexity CalculationAlgorithms & Complexity Calculation
Algorithms & Complexity Calculation
 
2. Asymptotic Notations and Complexity Analysis.pptx
2. Asymptotic Notations and Complexity Analysis.pptx2. Asymptotic Notations and Complexity Analysis.pptx
2. Asymptotic Notations and Complexity Analysis.pptx
 
DAA-Unit1.pptx
DAA-Unit1.pptxDAA-Unit1.pptx
DAA-Unit1.pptx
 
DSA
DSADSA
DSA
 
Searching Algorithms
Searching AlgorithmsSearching Algorithms
Searching Algorithms
 
Chapter One.pdf
Chapter One.pdfChapter One.pdf
Chapter One.pdf
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithms
 
Analysis.ppt
Analysis.pptAnalysis.ppt
Analysis.ppt
 
Algorithm
AlgorithmAlgorithm
Algorithm
 
Algorithm
AlgorithmAlgorithm
Algorithm
 
Asymptotic Notations
Asymptotic NotationsAsymptotic Notations
Asymptotic Notations
 
Asymptotic Notations.pptx
Asymptotic Notations.pptxAsymptotic Notations.pptx
Asymptotic Notations.pptx
 
18103010 algorithm complexity (iterative)
18103010 algorithm complexity (iterative)18103010 algorithm complexity (iterative)
18103010 algorithm complexity (iterative)
 
Asymptotics 140510003721-phpapp02
Asymptotics 140510003721-phpapp02Asymptotics 140510003721-phpapp02
Asymptotics 140510003721-phpapp02
 
Time_Complexity.pptx
Time_Complexity.pptxTime_Complexity.pptx
Time_Complexity.pptx
 
Ch1. Analysis of Algorithms.pdf
Ch1. Analysis of Algorithms.pdfCh1. Analysis of Algorithms.pdf
Ch1. Analysis of Algorithms.pdf
 
Lec1
Lec1Lec1
Lec1
 
Analysis and Algorithms: basic Introduction
Analysis and Algorithms: basic IntroductionAnalysis and Algorithms: basic Introduction
Analysis and Algorithms: basic Introduction
 
Data Structures- Part2 analysis tools
Data Structures- Part2 analysis toolsData Structures- Part2 analysis tools
Data Structures- Part2 analysis tools
 
algorithmanalysis and effciency.pptx
algorithmanalysis and effciency.pptxalgorithmanalysis and effciency.pptx
algorithmanalysis and effciency.pptx
 

More from subhashchandra197

More from subhashchandra197 (12)

Unit ii divide and conquer -4
Unit ii divide and conquer -4Unit ii divide and conquer -4
Unit ii divide and conquer -4
 
Unit ii divide and conquer -3
Unit ii divide and conquer -3Unit ii divide and conquer -3
Unit ii divide and conquer -3
 
Unit ii divide and conquer -2
Unit ii divide and conquer -2Unit ii divide and conquer -2
Unit ii divide and conquer -2
 
Unit ii divide and conquer -1
Unit ii divide and conquer -1Unit ii divide and conquer -1
Unit ii divide and conquer -1
 
Bs,qs,divide and conquer 1
Bs,qs,divide and conquer 1Bs,qs,divide and conquer 1
Bs,qs,divide and conquer 1
 
Recursive algorithms
Recursive algorithmsRecursive algorithms
Recursive algorithms
 
Recurrence relation solutions
Recurrence relation solutionsRecurrence relation solutions
Recurrence relation solutions
 
P,NP Hard, NP-Complete problems
P,NP Hard, NP-Complete problemsP,NP Hard, NP-Complete problems
P,NP Hard, NP-Complete problems
 
Turing machine material
Turing machine materialTuring machine material
Turing machine material
 
Turing machine types
Turing machine typesTuring machine types
Turing machine types
 
Introduction to algorithms
Introduction to algorithmsIntroduction to algorithms
Introduction to algorithms
 
Disjoint sets union, find
Disjoint sets  union, findDisjoint sets  union, find
Disjoint sets union, find
 

Recently uploaded

High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 

Recently uploaded (20)

High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 

Asymptotic notations

  • 2. Time Complexity of an Algorithm The function f(n), gives the running time of an algorithm, depends not only on the size ‘n’ of the input data but also on the particular data. The complexity function f(n) for certain cases are: 1. Best Case : The minimum possible value of f(n) is called the best case. 2. Average Case : The expected value of f(n). 3. Worst Case : The maximum value of f(n) for any key possible input. Analysis of Algorithms: The field of computer science, which studies efficiency of algorithms, is known as analysis of algorithms.
  • 4. Asymptotic notations Uses of Notations: Commonly use notations in performance analysis and used to characterize the complexity of an algorithm: • Big–OH (O) • Big–OMEGA • Big–THETA ()
  • 5. Common Asymptotic Notations • Following is a list of some common asymptotic notations: • constant − Ο(1) • logarithmic − Ο(log n) • Linear − Ο(n) • n log n − Ο(n log n) • quadratic − Ο(n2) • cubic − Ο(n3) • Polynomial − Ο(n1) • exponential − Ο(2n)
  • 7. Analysis of Algorithms Analyzing Algorithms Suppose ‘M’ is an algorithm, and suppose ‘n’ is the size of the input data. Clearly the complexity f(n) of M increases as n increases. It is usually the rate of increase of f(n) we want to examine. This is usually done by comparing f(n) with some standard functions. The most common computing times are: O(1), O(log2 n), O(n), O(n. log2 n), O(n2 ), O(n3 ), O(2n ), n! and nn
  • 8.
  • 9.
  • 10. Example on Big OH notation
  • 12.
  • 13.
  • 14. Example on Big OMEGA notation
  • 16.
  • 17.
  • 18.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 34. Plot
  • 35. • Example 1: • • Analysis for nested for loop • Now let’s look at a more complicated example, a nested for loop: • for (i = 1; i<=n; i++) • for (j = 1; j<=n; j++) • a[i,j] = b[i,j] * x;
  • 36. • Analysis of matrix multiply • Lets start with an easy case. Multiplying two n n matrices. • The code to compute the matrix product C = A * B is given below. • • for (i = 1; i<=n; i++) • for (j = 1; j<=n; j++) C[i, j] = 0; • for (k = 1; k<=n; k++) • C[i, j] = C[i, j] + A[i, k] * B[k, j];
  • 37. • Analysis of matrix multiply • • Lets start with an easy case. Multiplying two n n matrices. The code to compute the matrix product C = A * B is given below. • for (i = 1; i<=n; i++) • for (j = 1; j<=n; j++) C[i, j] = 0; • for (k = 1; k<=n; k++) • C[i, j] = C[i, j] + A[i, k] * B[k, j]; • • Analysis of bubble sort • The main body of the code for bubble sort looks something like this: • • for (i = n-1; i<1; i--) • for (j = 1; j<=i; j++) • if (a[j] > a[j+1]) • swap a[j] and a[j+1];
  • 38. General rules for the analysis of programs • The running time of each assignment read and write statement can usually be taken to be O(1). • The largest running time of any statement in the sequence. • The time to execute a loop is the sum, over all times around the loop, the time to execute the body and the time to evaluate the condition for termination • The running time of an if-statement is the cost of conditionally executed statements, plus the time for evaluating the condition. The time to evaluate the condition is normally O(1)
  • 39. General rules for the analysis of programs • Analyse for worst case scenario . • Rule 1: For large polynomial, Drop Lower order term, Drop Constant multiplier. • Rule 2: Total running time equal to sum of running time of all segments. • Rule 3: For Conditional statement , Pick complexity of condition which is worst case • Rule 4: The time hierarchy of complexities • O(1)<O(logn)<O(n)<O(nlogn) <O(n2) <O(n!)--- O(2n)