SlideShare a Scribd company logo
Chapter 2:Chapter 2:
Algorithm AnalysisAlgorithm Analysis
Big-Oh and Other Notations in
Algorithm Analysis
Lydia Sinapova, Simpson College
Mark Allen Weiss: Data Structures and Algorithm Analysis in Java
Big-Oh and Other Notations
in Algorithm Analysis
 Classifying Functions by Their
Asymptotic Growth
 Theta, Little oh, Little omega
 Big Oh, Big Omega
 Rules to manipulate Big-Oh
expressions
 Typical Growth Rates
Classifying Functions byClassifying Functions by
Their Asymptotic GrowthTheir Asymptotic Growth
Asymptotic growth : The rate of growth of
a function
Given a particular differentiable function
f(n), all other differentiable functions fall
into three classes:
.growing with the same rate
.growing faster
.growing slower
f(n) and g(n) have
same rate of growth, if
lim( f(n) / g(n) ) = c,
0 < c < ∞, n -> ∞
Notation: f(n) = Θ( g(n) )
pronounced "theta"
Theta
f(n) grows slower than g(n)
(or g(n) grows faster than f(n))
if
lim( f(n) / g(n) ) = 0, n → ∞
Notation: f(n) = o( g(n) )
pronounced "little oh"
Little oh
f(n) grows faster than g(n)
(or g(n) grows slower than f(n))
if
lim( f(n) / g(n) ) = ∞, n -> ∞
Notation: f(n) = ω (g(n))
pronounced "little omega"
Little omega
if g(n) = o( f(n) )
then f(n) = ω( g(n) )
Examples: Compare n and n2
lim( n/n2
) = 0, n → ∞, n = o(n2
)
lim( n2
/n ) = ∞, n → ∞, n2
= ω(n)
Little omega and Little oh
Theta: Relation of Equivalence
R: "having the same rate of growth":
relation of equivalence,
gives a partition over the set of all
differentiable functions - classes of
equivalence.
Functions in one and the same class
are equivalent with respect to their
growth.
Algorithms with Same Complexity
Two algorithms have same
complexity,
if the functions representing the number
of operations have
same rate of growth.
Among all functions with same rate of
growth we choose the simplest one to
Examples
Compare n and (n+1)/2
lim( n / ((n+1)/2 )) = 2,
same rate of growth
(n+1)/2 = Θ(n)
- rate of growth of a linear function
Examples
Compare n2 and n2+ 6n
lim( n2
/ (n2
+ 6n ) )= 1
same rate of growth.
n2
+6n = Θ(n2
)
rate of growth of a quadratic function
Examples
Compare log n and log n2
lim( log n / log n2 ) = 1/2
same rate of growth.
log n2 = Θ(log n)
logarithmic rate of growth
Θ(n3
): n3
5n3
+ 4n
105n3
+ 4n2
+ 6n
Θ(n2
): n2
5n2
+ 4n + 6
n2
+ 5
Θ(log n): log n
log n2
log (n + n3
)
Examples
Comparing Functions
 same rate of growth: g(n) = Θ(f(n))
 different rate of growth:
either g(n) = o (f(n))
g(n) grows slower than f(n),
and hence f(n) = ω(g(n))
or g(n) = ω (f(n))
g(n) grows faster than f(n),
and hence f(n) = o(g(n))
f(n) = O(g(n))
if f(n) grows with
same rate or slower than g(n).
f(n) = Θ(g(n)) or
f(n) = o(g(n))
The Big-Oh Notation
n+5 = Θ(n) = O(n) = O(n2
)
= O(n3
) = O(n5
)
the closest estimation: n+5 = Θ(n)
the general practice is to use
the Big-Oh notation:
n+5 = O(n)
Example
The inverse of Big-Oh is Ω
If g(n) = O(f(n)),
then f(n) = Ω (g(n))
f(n) grows faster or with the same
rate as g(n): f(n) = Ω (g(n))
The Big-Omega Notation
Rules to manipulate
Big-Oh expressions
Rule 1:
a. If
T1(N) = O(f(N))
and
T2(N) = O(g(N))
then
T1(N) + T2(N) =
max( O( f (N) ), O( g(N) ) )
Rules to manipulate
Big-Oh expressions
b. If
T1(N) = O( f(N) )
and
T2(N) = O( g(N) )
then
T1(N) * T2(N) = O( f(N)* g(N) )
Rules to manipulate
Big-Oh expressions
Rule 2:
If T(N) is a polynomial of degree k,
then
T(N) = Θ( Nk
)
Rule 3:
log k
N = O(N) for any constant k.
Examples
n2
+ n = O(n2
)
we disregard any lower-order term
nlog(n) = O(nlog(n))
n2
+nlog(n) = O(n2
)
C constant, we write O(1)
logN logarithmic
log2
N log-squared
N linear
NlogN
N2
quadratic
N3
cubic
2N
exponential
N! factorial
Typical Growth Rates
Problems
N2
= O(N2
) true
2N = O(N2
) true
N = O(N2
) true
N2
= O(N) false
2N = O(N) true
N = O(N) true
Problems
N2
= Θ (N2
)true
2N = Θ (N2
) false
N = Θ (N2
) false
N2
= Θ (N) false
2N = Θ (N) true
N = Θ (N) true

More Related Content

What's hot

Lec 5 asymptotic notations and recurrences
Lec 5 asymptotic notations and recurrencesLec 5 asymptotic notations and recurrences
Lec 5 asymptotic notations and recurrences
Ankita Karia
 
Time complexity
Time complexityTime complexity
Time complexity
Katang Isip
 
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
 
Time complexity (linear search vs binary search)
Time complexity (linear search vs binary search)Time complexity (linear search vs binary search)
Time complexity (linear search vs binary search)
Kumar
 
Asymptotic analysis
Asymptotic analysisAsymptotic analysis
Asymptotic analysis
Soujanya V
 
asymptotic notations i
asymptotic notations iasymptotic notations i
asymptotic notations i
Ali mahmood
 
Basics & asymptotic notations
Basics & asymptotic notationsBasics & asymptotic notations
Basics & asymptotic notations
Rajendran
 
Introduction to Algorithms and Asymptotic Notation
Introduction to Algorithms and Asymptotic NotationIntroduction to Algorithms and Asymptotic Notation
Introduction to Algorithms and Asymptotic Notation
Amrinder Arora
 
Asymptotic Notation
Asymptotic NotationAsymptotic Notation
Asymptotic Notation
Protap Mondal
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Analysis of algorithn class 3
Analysis of algorithn class 3Analysis of algorithn class 3
Analysis of algorithn class 3
Kumar
 
Algorithm.ppt
Algorithm.pptAlgorithm.ppt
Algorithm.ppt
Tareq Hasan
 
Time and space complexity
Time and space complexityTime and space complexity
Time and space complexity
Ankit Katiyar
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
Mamta Pandey
 
Big o
Big oBig o
Theta notation
Theta notationTheta notation
Theta notation
Rajesh K Shukla
 
Little o and little omega
Little o and little omegaLittle o and little omega
Little o and little omega
Rajesh K Shukla
 
Euclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
Euclid's Algorithm for Greatest Common Divisor - Time Complexity AnalysisEuclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
Euclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
Amrinder Arora
 
Computational Complexity
Computational ComplexityComputational Complexity
Computational Complexity
Kasun Ranga Wijeweera
 
Big omega
Big omegaBig omega
Big omega
Rajesh K Shukla
 

What's hot (20)

Lec 5 asymptotic notations and recurrences
Lec 5 asymptotic notations and recurrencesLec 5 asymptotic notations and recurrences
Lec 5 asymptotic notations and recurrences
 
Time complexity
Time complexityTime complexity
Time complexity
 
Asymptotic notations(Big O, Omega, Theta )
Asymptotic notations(Big O, Omega, Theta )Asymptotic notations(Big O, Omega, Theta )
Asymptotic notations(Big O, Omega, Theta )
 
Time complexity (linear search vs binary search)
Time complexity (linear search vs binary search)Time complexity (linear search vs binary search)
Time complexity (linear search vs binary search)
 
Asymptotic analysis
Asymptotic analysisAsymptotic analysis
Asymptotic analysis
 
asymptotic notations i
asymptotic notations iasymptotic notations i
asymptotic notations i
 
Basics & asymptotic notations
Basics & asymptotic notationsBasics & asymptotic notations
Basics & asymptotic notations
 
Introduction to Algorithms and Asymptotic Notation
Introduction to Algorithms and Asymptotic NotationIntroduction to Algorithms and Asymptotic Notation
Introduction to Algorithms and Asymptotic Notation
 
Asymptotic Notation
Asymptotic NotationAsymptotic Notation
Asymptotic Notation
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
Analysis of algorithn class 3
Analysis of algorithn class 3Analysis of algorithn class 3
Analysis of algorithn class 3
 
Algorithm.ppt
Algorithm.pptAlgorithm.ppt
Algorithm.ppt
 
Time and space complexity
Time and space complexityTime and space complexity
Time and space complexity
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
Big o
Big oBig o
Big o
 
Theta notation
Theta notationTheta notation
Theta notation
 
Little o and little omega
Little o and little omegaLittle o and little omega
Little o and little omega
 
Euclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
Euclid's Algorithm for Greatest Common Divisor - Time Complexity AnalysisEuclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
Euclid's Algorithm for Greatest Common Divisor - Time Complexity Analysis
 
Computational Complexity
Computational ComplexityComputational Complexity
Computational Complexity
 
Big omega
Big omegaBig omega
Big omega
 

Viewers also liked

Analysis of Algorithum
Analysis of AlgorithumAnalysis of Algorithum
Analysis of Algorithum
Ain-ul-Moiz Khawaja
 
Analysis of algo
Analysis of algoAnalysis of algo
Analysis of algo
Maneesha Srivastav
 
Analysis Of Algorithms I
Analysis Of Algorithms IAnalysis Of Algorithms I
Analysis Of Algorithms I
Sri Prasanna
 
Data structures and Big O notation
Data structures and Big O notationData structures and Big O notation
Data structures and Big O notation
Muthiah Abbhirami
 
9 big o-notation
9 big o-notation9 big o-notation
9 big o-notation
irdginfo
 
Algorithm Design and Complexity - Course 3
Algorithm Design and Complexity - Course 3Algorithm Design and Complexity - Course 3
Algorithm Design and Complexity - Course 3
Traian Rebedea
 
Algorithm big o
Algorithm big oAlgorithm big o
Algorithm big o
Ashim Lamichhane
 
QUESTION BANK FOR ANNA UNNIVERISTY SYLLABUS
QUESTION BANK FOR ANNA UNNIVERISTY SYLLABUSQUESTION BANK FOR ANNA UNNIVERISTY SYLLABUS
QUESTION BANK FOR ANNA UNNIVERISTY SYLLABUS
JAMBIKA
 
Big o notation
Big o notationBig o notation
Big o notation
keb97
 
Bfs and Dfs
Bfs and DfsBfs and Dfs
Bfs and Dfs
Masud Parvaze
 
2.5 bfs & dfs 02
2.5 bfs & dfs 022.5 bfs & dfs 02
2.5 bfs & dfs 02
Krish_ver2
 
Graphs bfs dfs
Graphs bfs dfsGraphs bfs dfs
Graphs bfs dfs
Jaya Gautam
 
Gephi Toolkit Tutorial
Gephi Toolkit TutorialGephi Toolkit Tutorial
Gephi Toolkit Tutorial
Gephi Consortium
 

Viewers also liked (13)

Analysis of Algorithum
Analysis of AlgorithumAnalysis of Algorithum
Analysis of Algorithum
 
Analysis of algo
Analysis of algoAnalysis of algo
Analysis of algo
 
Analysis Of Algorithms I
Analysis Of Algorithms IAnalysis Of Algorithms I
Analysis Of Algorithms I
 
Data structures and Big O notation
Data structures and Big O notationData structures and Big O notation
Data structures and Big O notation
 
9 big o-notation
9 big o-notation9 big o-notation
9 big o-notation
 
Algorithm Design and Complexity - Course 3
Algorithm Design and Complexity - Course 3Algorithm Design and Complexity - Course 3
Algorithm Design and Complexity - Course 3
 
Algorithm big o
Algorithm big oAlgorithm big o
Algorithm big o
 
QUESTION BANK FOR ANNA UNNIVERISTY SYLLABUS
QUESTION BANK FOR ANNA UNNIVERISTY SYLLABUSQUESTION BANK FOR ANNA UNNIVERISTY SYLLABUS
QUESTION BANK FOR ANNA UNNIVERISTY SYLLABUS
 
Big o notation
Big o notationBig o notation
Big o notation
 
Bfs and Dfs
Bfs and DfsBfs and Dfs
Bfs and Dfs
 
2.5 bfs & dfs 02
2.5 bfs & dfs 022.5 bfs & dfs 02
2.5 bfs & dfs 02
 
Graphs bfs dfs
Graphs bfs dfsGraphs bfs dfs
Graphs bfs dfs
 
Gephi Toolkit Tutorial
Gephi Toolkit TutorialGephi Toolkit Tutorial
Gephi Toolkit Tutorial
 

Similar to Algorithum Analysis

Complete Book Lectures maths theory helpful for kids.ppt
Complete Book Lectures maths theory helpful for kids.pptComplete Book Lectures maths theory helpful for kids.ppt
Complete Book Lectures maths theory helpful for kids.ppt
AishaAnwar16
 
lecture 1
lecture 1lecture 1
lecture 1
sajinsc
 
Lecture 4 - Growth of Functions.ppt
Lecture 4 - Growth of Functions.pptLecture 4 - Growth of Functions.ppt
Lecture 4 - Growth of Functions.ppt
ZohairMughal1
 
Lecture 4 - Growth of Functions (1).ppt
Lecture 4 - Growth of Functions (1).pptLecture 4 - Growth of Functions (1).ppt
Lecture 4 - Growth of Functions (1).ppt
ZohairMughal1
 
Lecture 3(a) Asymptotic-analysis.pdf
Lecture 3(a) Asymptotic-analysis.pdfLecture 3(a) Asymptotic-analysis.pdf
Lecture 3(a) Asymptotic-analysis.pdf
ShaistaRiaz4
 
analysis.ppt
analysis.pptanalysis.ppt
analysis.ppt
AarushSharma69
 
Clase3 Notacion
Clase3 NotacionClase3 Notacion
Clase3 Notacion
luzenith_g
 
Asymptotic Notations
Asymptotic NotationsAsymptotic Notations
Asymptotic Notations
NagendraK18
 
AlgorithmAnalysis2.ppt
AlgorithmAnalysis2.pptAlgorithmAnalysis2.ppt
AlgorithmAnalysis2.ppt
REMEGIUSPRAVEENSAHAY
 
04. Growth_Rate_AND_Asymptotic Notations_.pptx
04. Growth_Rate_AND_Asymptotic Notations_.pptx04. Growth_Rate_AND_Asymptotic Notations_.pptx
04. Growth_Rate_AND_Asymptotic Notations_.pptx
arslanzaheer14
 
5261506.ppt
5261506.ppt5261506.ppt
5261506.ppt
RamaKrishnaErroju
 
Asymptotic notation ada
Asymptotic notation adaAsymptotic notation ada
Asymptotic notation ada
ravinlaheri2
 
algorithm_analysis1
algorithm_analysis1algorithm_analysis1
algorithm_analysis1
Mohamed Elsayed
 
Weekends with Competitive Programming
Weekends with Competitive ProgrammingWeekends with Competitive Programming
Weekends with Competitive Programming
NiharikaSingh839269
 
The bog oh notation
The bog oh notationThe bog oh notation
The bog oh notation
Rajesh K Shukla
 
big_oh
big_ohbig_oh
Runtime Analysis of Population-based Evolutionary Algorithms
Runtime Analysis of Population-based Evolutionary AlgorithmsRuntime Analysis of Population-based Evolutionary Algorithms
Runtime Analysis of Population-based Evolutionary Algorithms
Per Kristian Lehre
 
Runtime Analysis of Population-based Evolutionary Algorithms
Runtime Analysis of Population-based Evolutionary AlgorithmsRuntime Analysis of Population-based Evolutionary Algorithms
Runtime Analysis of Population-based Evolutionary Algorithms
PK Lehre
 
Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1
Deepak John
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithms
S.Shayan Daneshvar
 

Similar to Algorithum Analysis (20)

Complete Book Lectures maths theory helpful for kids.ppt
Complete Book Lectures maths theory helpful for kids.pptComplete Book Lectures maths theory helpful for kids.ppt
Complete Book Lectures maths theory helpful for kids.ppt
 
lecture 1
lecture 1lecture 1
lecture 1
 
Lecture 4 - Growth of Functions.ppt
Lecture 4 - Growth of Functions.pptLecture 4 - Growth of Functions.ppt
Lecture 4 - Growth of Functions.ppt
 
Lecture 4 - Growth of Functions (1).ppt
Lecture 4 - Growth of Functions (1).pptLecture 4 - Growth of Functions (1).ppt
Lecture 4 - Growth of Functions (1).ppt
 
Lecture 3(a) Asymptotic-analysis.pdf
Lecture 3(a) Asymptotic-analysis.pdfLecture 3(a) Asymptotic-analysis.pdf
Lecture 3(a) Asymptotic-analysis.pdf
 
analysis.ppt
analysis.pptanalysis.ppt
analysis.ppt
 
Clase3 Notacion
Clase3 NotacionClase3 Notacion
Clase3 Notacion
 
Asymptotic Notations
Asymptotic NotationsAsymptotic Notations
Asymptotic Notations
 
AlgorithmAnalysis2.ppt
AlgorithmAnalysis2.pptAlgorithmAnalysis2.ppt
AlgorithmAnalysis2.ppt
 
04. Growth_Rate_AND_Asymptotic Notations_.pptx
04. Growth_Rate_AND_Asymptotic Notations_.pptx04. Growth_Rate_AND_Asymptotic Notations_.pptx
04. Growth_Rate_AND_Asymptotic Notations_.pptx
 
5261506.ppt
5261506.ppt5261506.ppt
5261506.ppt
 
Asymptotic notation ada
Asymptotic notation adaAsymptotic notation ada
Asymptotic notation ada
 
algorithm_analysis1
algorithm_analysis1algorithm_analysis1
algorithm_analysis1
 
Weekends with Competitive Programming
Weekends with Competitive ProgrammingWeekends with Competitive Programming
Weekends with Competitive Programming
 
The bog oh notation
The bog oh notationThe bog oh notation
The bog oh notation
 
big_oh
big_ohbig_oh
big_oh
 
Runtime Analysis of Population-based Evolutionary Algorithms
Runtime Analysis of Population-based Evolutionary AlgorithmsRuntime Analysis of Population-based Evolutionary Algorithms
Runtime Analysis of Population-based Evolutionary Algorithms
 
Runtime Analysis of Population-based Evolutionary Algorithms
Runtime Analysis of Population-based Evolutionary AlgorithmsRuntime Analysis of Population-based Evolutionary Algorithms
Runtime Analysis of Population-based Evolutionary Algorithms
 
Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1Anlysis and design of algorithms part 1
Anlysis and design of algorithms part 1
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithms
 

More from Ain-ul-Moiz Khawaja

Algo>Queues
Algo>QueuesAlgo>Queues
Algo>Queues
Ain-ul-Moiz Khawaja
 
Application of Stacks
Application of StacksApplication of Stacks
Application of Stacks
Ain-ul-Moiz Khawaja
 
Algo>Stacks
Algo>StacksAlgo>Stacks
Algo>Stacks
Ain-ul-Moiz Khawaja
 
Algo>ADT list & linked list
Algo>ADT list & linked listAlgo>ADT list & linked list
Algo>ADT list & linked list
Ain-ul-Moiz Khawaja
 
Algo>Arrays
Algo>ArraysAlgo>Arrays
Algo>Arrays
Ain-ul-Moiz Khawaja
 
Algo>Abstract data type
Algo>Abstract data typeAlgo>Abstract data type
Algo>Abstract data type
Ain-ul-Moiz Khawaja
 
Sorting algorithums > Data Structures & Algorithums
Sorting algorithums  > Data Structures & AlgorithumsSorting algorithums  > Data Structures & Algorithums
Sorting algorithums > Data Structures & Algorithums
Ain-ul-Moiz Khawaja
 
Sorting algos > Data Structures & Algorithums
Sorting algos  > Data Structures & AlgorithumsSorting algos  > Data Structures & Algorithums
Sorting algos > Data Structures & Algorithums
Ain-ul-Moiz Khawaja
 
Huffman > Data Structures & Algorithums
Huffman > Data Structures & AlgorithumsHuffman > Data Structures & Algorithums
Huffman > Data Structures & Algorithums
Ain-ul-Moiz Khawaja
 
Graphs > Discrete structures , Data Structures & Algorithums
Graphs > Discrete structures , Data Structures & AlgorithumsGraphs > Discrete structures , Data Structures & Algorithums
Graphs > Discrete structures , Data Structures & Algorithums
Ain-ul-Moiz Khawaja
 
Data Structures & Algorithms
Data Structures & AlgorithmsData Structures & Algorithms
Data Structures & Algorithms
Ain-ul-Moiz Khawaja
 
Turn over
Turn overTurn over
Attribution Theories
Attribution TheoriesAttribution Theories
Attribution Theories
Ain-ul-Moiz Khawaja
 
Attribution Theory
Attribution TheoryAttribution Theory
Attribution Theory
Ain-ul-Moiz Khawaja
 
Absenteeism
AbsenteeismAbsenteeism
Absenteeism
Ain-ul-Moiz Khawaja
 
HRM Employee Turnover
HRM Employee TurnoverHRM Employee Turnover
HRM Employee Turnover
Ain-ul-Moiz Khawaja
 

More from Ain-ul-Moiz Khawaja (16)

Algo>Queues
Algo>QueuesAlgo>Queues
Algo>Queues
 
Application of Stacks
Application of StacksApplication of Stacks
Application of Stacks
 
Algo>Stacks
Algo>StacksAlgo>Stacks
Algo>Stacks
 
Algo>ADT list & linked list
Algo>ADT list & linked listAlgo>ADT list & linked list
Algo>ADT list & linked list
 
Algo>Arrays
Algo>ArraysAlgo>Arrays
Algo>Arrays
 
Algo>Abstract data type
Algo>Abstract data typeAlgo>Abstract data type
Algo>Abstract data type
 
Sorting algorithums > Data Structures & Algorithums
Sorting algorithums  > Data Structures & AlgorithumsSorting algorithums  > Data Structures & Algorithums
Sorting algorithums > Data Structures & Algorithums
 
Sorting algos > Data Structures & Algorithums
Sorting algos  > Data Structures & AlgorithumsSorting algos  > Data Structures & Algorithums
Sorting algos > Data Structures & Algorithums
 
Huffman > Data Structures & Algorithums
Huffman > Data Structures & AlgorithumsHuffman > Data Structures & Algorithums
Huffman > Data Structures & Algorithums
 
Graphs > Discrete structures , Data Structures & Algorithums
Graphs > Discrete structures , Data Structures & AlgorithumsGraphs > Discrete structures , Data Structures & Algorithums
Graphs > Discrete structures , Data Structures & Algorithums
 
Data Structures & Algorithms
Data Structures & AlgorithmsData Structures & Algorithms
Data Structures & Algorithms
 
Turn over
Turn overTurn over
Turn over
 
Attribution Theories
Attribution TheoriesAttribution Theories
Attribution Theories
 
Attribution Theory
Attribution TheoryAttribution Theory
Attribution Theory
 
Absenteeism
AbsenteeismAbsenteeism
Absenteeism
 
HRM Employee Turnover
HRM Employee TurnoverHRM Employee Turnover
HRM Employee Turnover
 

Recently uploaded

BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
Nguyen Thanh Tu Collection
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Electric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger HuntElectric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger Hunt
RamseyBerglund
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
BoudhayanBhattachari
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
nitinpv4ai
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdfمصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
سمير بسيوني
 
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDFLifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Vivekanand Anglo Vedic Academy
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
HajraNaeem15
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
deepaannamalai16
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
melliereed
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
zuzanka
 
Stack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 MicroprocessorStack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 Microprocessor
JomonJoseph58
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
imrankhan141184
 

Recently uploaded (20)

BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Electric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger HuntElectric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger Hunt
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdfمصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
 
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDFLifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
 
Stack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 MicroprocessorStack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 Microprocessor
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
 

Algorithum Analysis

  • 1. Chapter 2:Chapter 2: Algorithm AnalysisAlgorithm Analysis Big-Oh and Other Notations in Algorithm Analysis Lydia Sinapova, Simpson College Mark Allen Weiss: Data Structures and Algorithm Analysis in Java
  • 2. Big-Oh and Other Notations in Algorithm Analysis  Classifying Functions by Their Asymptotic Growth  Theta, Little oh, Little omega  Big Oh, Big Omega  Rules to manipulate Big-Oh expressions  Typical Growth Rates
  • 3. Classifying Functions byClassifying Functions by Their Asymptotic GrowthTheir Asymptotic Growth Asymptotic growth : The rate of growth of a function Given a particular differentiable function f(n), all other differentiable functions fall into three classes: .growing with the same rate .growing faster .growing slower
  • 4. f(n) and g(n) have same rate of growth, if lim( f(n) / g(n) ) = c, 0 < c < ∞, n -> ∞ Notation: f(n) = Θ( g(n) ) pronounced "theta" Theta
  • 5. f(n) grows slower than g(n) (or g(n) grows faster than f(n)) if lim( f(n) / g(n) ) = 0, n → ∞ Notation: f(n) = o( g(n) ) pronounced "little oh" Little oh
  • 6. f(n) grows faster than g(n) (or g(n) grows slower than f(n)) if lim( f(n) / g(n) ) = ∞, n -> ∞ Notation: f(n) = ω (g(n)) pronounced "little omega" Little omega
  • 7. if g(n) = o( f(n) ) then f(n) = ω( g(n) ) Examples: Compare n and n2 lim( n/n2 ) = 0, n → ∞, n = o(n2 ) lim( n2 /n ) = ∞, n → ∞, n2 = ω(n) Little omega and Little oh
  • 8. Theta: Relation of Equivalence R: "having the same rate of growth": relation of equivalence, gives a partition over the set of all differentiable functions - classes of equivalence. Functions in one and the same class are equivalent with respect to their growth.
  • 9. Algorithms with Same Complexity Two algorithms have same complexity, if the functions representing the number of operations have same rate of growth. Among all functions with same rate of growth we choose the simplest one to
  • 10. Examples Compare n and (n+1)/2 lim( n / ((n+1)/2 )) = 2, same rate of growth (n+1)/2 = Θ(n) - rate of growth of a linear function
  • 11. Examples Compare n2 and n2+ 6n lim( n2 / (n2 + 6n ) )= 1 same rate of growth. n2 +6n = Θ(n2 ) rate of growth of a quadratic function
  • 12. Examples Compare log n and log n2 lim( log n / log n2 ) = 1/2 same rate of growth. log n2 = Θ(log n) logarithmic rate of growth
  • 13. Θ(n3 ): n3 5n3 + 4n 105n3 + 4n2 + 6n Θ(n2 ): n2 5n2 + 4n + 6 n2 + 5 Θ(log n): log n log n2 log (n + n3 ) Examples
  • 14. Comparing Functions  same rate of growth: g(n) = Θ(f(n))  different rate of growth: either g(n) = o (f(n)) g(n) grows slower than f(n), and hence f(n) = ω(g(n)) or g(n) = ω (f(n)) g(n) grows faster than f(n), and hence f(n) = o(g(n))
  • 15. f(n) = O(g(n)) if f(n) grows with same rate or slower than g(n). f(n) = Θ(g(n)) or f(n) = o(g(n)) The Big-Oh Notation
  • 16. n+5 = Θ(n) = O(n) = O(n2 ) = O(n3 ) = O(n5 ) the closest estimation: n+5 = Θ(n) the general practice is to use the Big-Oh notation: n+5 = O(n) Example
  • 17. The inverse of Big-Oh is Ω If g(n) = O(f(n)), then f(n) = Ω (g(n)) f(n) grows faster or with the same rate as g(n): f(n) = Ω (g(n)) The Big-Omega Notation
  • 18. Rules to manipulate Big-Oh expressions Rule 1: a. If T1(N) = O(f(N)) and T2(N) = O(g(N)) then T1(N) + T2(N) = max( O( f (N) ), O( g(N) ) )
  • 19. Rules to manipulate Big-Oh expressions b. If T1(N) = O( f(N) ) and T2(N) = O( g(N) ) then T1(N) * T2(N) = O( f(N)* g(N) )
  • 20. Rules to manipulate Big-Oh expressions Rule 2: If T(N) is a polynomial of degree k, then T(N) = Θ( Nk ) Rule 3: log k N = O(N) for any constant k.
  • 21. Examples n2 + n = O(n2 ) we disregard any lower-order term nlog(n) = O(nlog(n)) n2 +nlog(n) = O(n2 )
  • 22. C constant, we write O(1) logN logarithmic log2 N log-squared N linear NlogN N2 quadratic N3 cubic 2N exponential N! factorial Typical Growth Rates
  • 23. Problems N2 = O(N2 ) true 2N = O(N2 ) true N = O(N2 ) true N2 = O(N) false 2N = O(N) true N = O(N) true
  • 24. Problems N2 = Θ (N2 )true 2N = Θ (N2 ) false N = Θ (N2 ) false N2 = Θ (N) false 2N = Θ (N) true N = Θ (N) true