SlideShare ist ein Scribd-Unternehmen logo
1 von 20
Introduction to Algorithms
(3rd edition)
by Cormen, Leiserson, Rivest & Stein
Chapter 3: Growth of Functions
(slides enhanced by N. Adlai A. DePano)
Overview
ïŻ Order of growth of functions provides a
simple characterization of efficiency
ïŻ Allows for comparison of relative
performance between alternative
algorithms
ïŻ Concerned with asymptotic efficiency of
algorithms
ïŻ Best asymptotic efficiency usually is best
choice except for smaller inputs
ïŻ Several standard methods to simplify
asymptotic analysis of algorithms
Asymptotic Notation
ïŻ Applies to functions whose domains are the
set of natural numbers:
N = {0,1,2,
}
ïŻ If time resource T(n) is being analyzed, the
function’s range is usually the set of non-
negative real numbers:
T(n)  R+
ïŻ If space resource S(n) is being analyzed, the
function’s range is usually also the set of
natural numbers:
S(n)  N
Asymptotic Notation
ïŻ Depending on the textbook,
asymptotic categories may be
expressed in terms of --
a. set membership (our textbook):
functions belong to a family of functions
that exhibit some property; or
b. function property (other textbooks):
functions exhibit the property
ïŻ Caveat: we will formally use (a) and
informally use (b)
The Θ-Notation
f
c1 ⋅ g
n0
c2 ⋅ g
Θ(g(n)) = { f(n) : ∃c1, c2 > 0, n0 > 0 s.t. ∀n ≄ n0:
c1 · g(n) ≀ f(n) ≀ c2 ⋅ g(n) }
The Ω-Notation
Ω(g(n)) = { f(n) : ∃c > 0, n0 > 0 s.t. ∀n ≄ n0: f(n) ≄ c ⋅ g(n) }
f
c ⋅ g
n0
The O-Notation
f
c ⋅ g
n0
O(g(n)) = { f(n) : ∃c > 0, n0 > 0 s.t. ∀n ≄ n0: f(n) ≀ c ⋅ g(n) }
The o-Notation
o(g(n)) = { f(n) : ∀c > 0 ∃n0 > 0 s.t. ∀n ≄ n0: f(n) ≀ c ⋅ g(n) }
f
c1 ⋅ g
n1
c2 ⋅ g
c3 ⋅ g
n2 n3
The ω-Notation
f
c1 ⋅ g
n1
c2 ⋅ g
c3 ⋅ g
n2
n3
ω(g(n)) = { f(n) : ∀c > 0 ∃n0 > 0 s.t. ∀n ≄ n0: f(n) ≄ c ⋅ g(n) }
ïŻ f(n) = O(g(n)) and
g(n) = O(h(n)) ⇒ f(n) = O(h(n))
ïŻ f(n) = Ω(g(n)) and
g(n) = Ω(h(n)) ⇒ f(n) = Ω(h(n))
ïŻ f(n) = Θ(g(n)) and
g(n) = Θ(h(n)) ⇒ f(n) = Θ(h(n))
ïŻ f(n) = O(f(n))
f(n) = Ω(f(n))
f(n) = Θ(f(n))
Comparison of Functions
Reflexivity
Transitivity
ïŻ f (n) = Θ(g(n))  g(n) = Θ(f (n))
ïŻ f (n) = O(g(n))  g(n) = Ω(f (n))
ïŻ f (n) = o(g(n))  g(n) = ω(f (n))
ïŻ f (n) = O(g(n)) and
f (n) = Ω(g(n))  f (n) = Θ(g(n))
Comparison of Functions
Transpose
Symmetry
Symmetry
Theorem 3.1
Standard Notation and
Common Functions
ïŻ Monotonicity
A function f(n) is monotonically
increasing if m ï‚Ł n implies f(m) ï‚Ł f(n) .
A function f(n) is monotonically
decreasing if m ï‚Ł n implies f(m) ï‚ł f(n) .
A function f(n) is strictly increasing
if m < n implies f(m) < f(n) .
A function f(n) is strictly decreasing
if m < n implies f(m) > f(n) .
Standard Notation and
Common Functions
ïŻ Floors and ceilings
For any real number x, the greatest integer
less than or equal to x is denoted by x.
For any real number x, the least integer
greater than or equal to x is denoted by
xïƒč.
For all real numbers x,
x1 < x ï‚Ł x ï‚Ł xïƒč < x+1.
Both functions are monotonically
increasing.
Standard Notation and
Common Functions
ïŻ Exponentials
For all n and aï‚ł1, the function an is the exponential
function with base a and is monotonically
increasing.
ïŻ Logarithms
Textbook adopts the following convention
lg n = log2n (binary logarithm),
ln n = logen (natural logarithm),
lgk n = (lg n)k (exponentiation),
lg lg n = lg(lg n) (composition),
lg n + k = (lg n)+k (precedence of lg).
Standard Notation and
Common Functions
ïŻ Factorials
For all n the function n! or “n factorial” is
given by
n! = n ï‚Ž (n1) ï‚Ž (n  2) ï‚Ž (n  3) ï‚Ž 
 ï‚Ž 2 ï‚Ž 1
It can be established that
n! = o(nn)
n! = (2n)
lg(n!) = (nlgn)
ïŻ Functional iteration
The notation f (i)(n) represents the function f(n)
iteratively applied i times to an initial value of n,
or, recursively
f (i)(n) = n if i=0
f (i)(n) = f(f (i1)(n)) if i>0
Example:
If f (n) = 2n
then f (2)(n) = f (2n) = 2(2n) = 22n
then f (3)(n) = f (f (2)(n)) = 2(22n) = 23n
then f (i)(n) = 2in
Standard Notation and
Common Functions
ïŻ Iterated logarithmic function
The notation lg* n which reads “log star of n” is
defined as
lg* n = min {iï‚ł0 : lg(i) n ï‚Ł 1
Example:
lg* 2 = 1
lg* 4 = 2
lg* 16 = 3
lg* 65536 = 4
lg* 265536 = 5
Standard Notation and
Common Functions
ïŻ Asymptotic analysis studies how the
values of functions compare as their
arguments grow without bounds.
ïŻ Ignores constants and the behavior of
the function for small arguments.
ïŻ Acceptable because all algorithms are
fast for small inputs and growth of
running time is more important than
constant factors.
Things to Remember
ïŻ Ignoring the usually unimportant details,
we obtain a representation that succinctly
describes the growth of a function as
its argument grows and thus allows us to
make comparisons between algorithms in
terms of their efficiency.
Things to Remember
Tips to Help Remember
ïŻ May be helpful to make the following
“analogies” (remember, we are comparing
rates of growth of functions)

Weitere Àhnliche Inhalte

Ähnlich wie Lecture 4 - Growth of Functions (1).ppt

Asymptotic Notation
Asymptotic NotationAsymptotic Notation
Asymptotic NotationProtap Mondal
 
DAA_LECT_2.pdf
DAA_LECT_2.pdfDAA_LECT_2.pdf
DAA_LECT_2.pdfAryanSaini69
 
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 1Deepak John
 
lecture 3
lecture 3lecture 3
lecture 3sajinsc
 
Design and analysis of algorithm ppt ppt
Design and analysis of algorithm ppt pptDesign and analysis of algorithm ppt ppt
Design and analysis of algorithm ppt pptsrushtiivp
 
Unit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdfUnit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdfAmayJaiswal4
 
Dr hasany 2467_16649_1_lec-2-zabist
Dr hasany 2467_16649_1_lec-2-zabistDr hasany 2467_16649_1_lec-2-zabist
Dr hasany 2467_16649_1_lec-2-zabistGatewayggg Testeru
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notationsEhtisham Ali
 
AsymptoticAnalysis.ppt
AsymptoticAnalysis.pptAsymptoticAnalysis.ppt
AsymptoticAnalysis.pptSiddheshUpadhyay3
 
lecture 1
lecture 1lecture 1
lecture 1sajinsc
 
Asymptotic analysis
Asymptotic analysisAsymptotic analysis
Asymptotic analysisSoujanya V
 
Asymptotic Growth of Functions
Asymptotic Growth of FunctionsAsymptotic Growth of Functions
Asymptotic Growth of FunctionsDEVTYPE
 
MLPèŒȘèȘ­ă‚čăƒă‚šăƒŒă‚č8ç«  ăƒˆăƒŹăƒŒă‚čăƒŽăƒ«ăƒ æ­Łć‰‡ćŒ–
MLPèŒȘèȘ­ă‚čăƒă‚šăƒŒă‚č8ç«  ăƒˆăƒŹăƒŒă‚čăƒŽăƒ«ăƒ æ­Łć‰‡ćŒ–MLPèŒȘèȘ­ă‚čăƒă‚šăƒŒă‚č8ç«  ăƒˆăƒŹăƒŒă‚čăƒŽăƒ«ăƒ æ­Łć‰‡ćŒ–
MLPèŒȘèȘ­ă‚čăƒă‚šăƒŒă‚č8ç«  ăƒˆăƒŹăƒŒă‚čăƒŽăƒ«ăƒ æ­Łć‰‡ćŒ–Akira Tanimoto
 
Introducing Zap Q-Learning
Introducing Zap Q-Learning   Introducing Zap Q-Learning
Introducing Zap Q-Learning Sean Meyn
 
Algorithm.ppt
Algorithm.pptAlgorithm.ppt
Algorithm.pptTareq Hasan
 

Ähnlich wie Lecture 4 - Growth of Functions (1).ppt (20)

Asymptotic Notation
Asymptotic NotationAsymptotic Notation
Asymptotic Notation
 
DAA_LECT_2.pdf
DAA_LECT_2.pdfDAA_LECT_2.pdf
DAA_LECT_2.pdf
 
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
 
lecture 3
lecture 3lecture 3
lecture 3
 
Design and analysis of algorithm ppt ppt
Design and analysis of algorithm ppt pptDesign and analysis of algorithm ppt ppt
Design and analysis of algorithm ppt ppt
 
Unit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdfUnit-1 DAA_Notes.pdf
Unit-1 DAA_Notes.pdf
 
AlgorithmAnalysis2.ppt
AlgorithmAnalysis2.pptAlgorithmAnalysis2.ppt
AlgorithmAnalysis2.ppt
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
Dr hasany 2467_16649_1_lec-2-zabist
Dr hasany 2467_16649_1_lec-2-zabistDr hasany 2467_16649_1_lec-2-zabist
Dr hasany 2467_16649_1_lec-2-zabist
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
Time complexity
Time complexityTime complexity
Time complexity
 
AsymptoticAnalysis.ppt
AsymptoticAnalysis.pptAsymptoticAnalysis.ppt
AsymptoticAnalysis.ppt
 
lecture 1
lecture 1lecture 1
lecture 1
 
Asymptotic analysis
Asymptotic analysisAsymptotic analysis
Asymptotic analysis
 
Sequences
SequencesSequences
Sequences
 
Asymptotic Growth of Functions
Asymptotic Growth of FunctionsAsymptotic Growth of Functions
Asymptotic Growth of Functions
 
MLPèŒȘèȘ­ă‚čăƒă‚šăƒŒă‚č8ç«  ăƒˆăƒŹăƒŒă‚čăƒŽăƒ«ăƒ æ­Łć‰‡ćŒ–
MLPèŒȘèȘ­ă‚čăƒă‚šăƒŒă‚č8ç«  ăƒˆăƒŹăƒŒă‚čăƒŽăƒ«ăƒ æ­Łć‰‡ćŒ–MLPèŒȘèȘ­ă‚čăƒă‚šăƒŒă‚č8ç«  ăƒˆăƒŹăƒŒă‚čăƒŽăƒ«ăƒ æ­Łć‰‡ćŒ–
MLPèŒȘèȘ­ă‚čăƒă‚šăƒŒă‚č8ç«  ăƒˆăƒŹăƒŒă‚čăƒŽăƒ«ăƒ æ­Łć‰‡ćŒ–
 
Introducing Zap Q-Learning
Introducing Zap Q-Learning   Introducing Zap Q-Learning
Introducing Zap Q-Learning
 
Slide2
Slide2Slide2
Slide2
 
Algorithm.ppt
Algorithm.pptAlgorithm.ppt
Algorithm.ppt
 

Mehr von ZohairMughal1

HCI Lecture # 2 (2).pptx
HCI Lecture # 2 (2).pptxHCI Lecture # 2 (2).pptx
HCI Lecture # 2 (2).pptxZohairMughal1
 
OS Thr schd.ppt
OS Thr schd.pptOS Thr schd.ppt
OS Thr schd.pptZohairMughal1
 
SE 09 (test design techs).pptx
SE 09 (test design techs).pptxSE 09 (test design techs).pptx
SE 09 (test design techs).pptxZohairMughal1
 
Lecture # 8 (HCI).pptx
Lecture # 8 (HCI).pptxLecture # 8 (HCI).pptx
Lecture # 8 (HCI).pptxZohairMughal1
 
Lecture 4 - Growth of Functions.ppt
Lecture 4 - Growth of Functions.pptLecture 4 - Growth of Functions.ppt
Lecture 4 - Growth of Functions.pptZohairMughal1
 
Khilafat-o-Malookeyat-Syed-Abul-Ala-Maududi-Urdu.pdf
Khilafat-o-Malookeyat-Syed-Abul-Ala-Maududi-Urdu.pdfKhilafat-o-Malookeyat-Syed-Abul-Ala-Maududi-Urdu.pdf
Khilafat-o-Malookeyat-Syed-Abul-Ala-Maududi-Urdu.pdfZohairMughal1
 

Mehr von ZohairMughal1 (6)

HCI Lecture # 2 (2).pptx
HCI Lecture # 2 (2).pptxHCI Lecture # 2 (2).pptx
HCI Lecture # 2 (2).pptx
 
OS Thr schd.ppt
OS Thr schd.pptOS Thr schd.ppt
OS Thr schd.ppt
 
SE 09 (test design techs).pptx
SE 09 (test design techs).pptxSE 09 (test design techs).pptx
SE 09 (test design techs).pptx
 
Lecture # 8 (HCI).pptx
Lecture # 8 (HCI).pptxLecture # 8 (HCI).pptx
Lecture # 8 (HCI).pptx
 
Lecture 4 - Growth of Functions.ppt
Lecture 4 - Growth of Functions.pptLecture 4 - Growth of Functions.ppt
Lecture 4 - Growth of Functions.ppt
 
Khilafat-o-Malookeyat-Syed-Abul-Ala-Maududi-Urdu.pdf
Khilafat-o-Malookeyat-Syed-Abul-Ala-Maududi-Urdu.pdfKhilafat-o-Malookeyat-Syed-Abul-Ala-Maududi-Urdu.pdf
Khilafat-o-Malookeyat-Syed-Abul-Ala-Maududi-Urdu.pdf
 

KĂŒrzlich hochgeladen

The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai KuwaitThe Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwaitdaisycvs
 
Falcon's Invoice Discounting: Your Path to Prosperity
Falcon's Invoice Discounting: Your Path to ProsperityFalcon's Invoice Discounting: Your Path to Prosperity
Falcon's Invoice Discounting: Your Path to Prosperityhemanthkumar470700
 
Call Girls From Pari Chowk Greater Noida ❀8448577510 âŠčBest Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❀8448577510 âŠčBest Escorts Service I...Call Girls From Pari Chowk Greater Noida ❀8448577510 âŠčBest Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❀8448577510 âŠčBest Escorts Service I...lizamodels9
 
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...allensay1
 
Phases of Negotiation .pptx
 Phases of Negotiation .pptx Phases of Negotiation .pptx
Phases of Negotiation .pptxnandhinijagan9867
 
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...amitlee9823
 
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdfDr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdfAdmir Softic
 
Falcon Invoice Discounting: Empowering Your Business Growth
Falcon Invoice Discounting: Empowering Your Business GrowthFalcon Invoice Discounting: Empowering Your Business Growth
Falcon Invoice Discounting: Empowering Your Business GrowthFalcon investment
 
JAYNAGAR CALL GIRL IN 98274*61493 ❀CALL GIRLS IN ESCORT SERVICE❀CALL GIRL
JAYNAGAR CALL GIRL IN 98274*61493 ❀CALL GIRLS IN ESCORT SERVICE❀CALL GIRLJAYNAGAR CALL GIRL IN 98274*61493 ❀CALL GIRLS IN ESCORT SERVICE❀CALL GIRL
JAYNAGAR CALL GIRL IN 98274*61493 ❀CALL GIRLS IN ESCORT SERVICE❀CALL GIRLkapoorjyoti4444
 
Chandigarh Escorts Service 📞8868886958📞 JustđŸ“Č Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 JustđŸ“Č Call Nihal Chandigarh Call Girl...Chandigarh Escorts Service 📞8868886958📞 JustđŸ“Č Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 JustđŸ“Č Call Nihal Chandigarh Call Girl...Sheetaleventcompany
 
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...amitlee9823
 
It will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayIt will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayNZSG
 
Katrina Personal Brand Project and portfolio 1
Katrina Personal Brand Project and portfolio 1Katrina Personal Brand Project and portfolio 1
Katrina Personal Brand Project and portfolio 1kcpayne
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756dollysharma2066
 
Russian Call Girls In Gurgaon ❀8448577510 âŠčBest Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❀8448577510 âŠčBest Escorts Service In 24/7 Delh...Russian Call Girls In Gurgaon ❀8448577510 âŠčBest Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❀8448577510 âŠčBest Escorts Service In 24/7 Delh...lizamodels9
 
Value Proposition canvas- Customer needs and pains
Value Proposition canvas- Customer needs and painsValue Proposition canvas- Customer needs and pains
Value Proposition canvas- Customer needs and painsP&CO
 
Famous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st CenturyFamous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st Centuryrwgiffor
 
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesMysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesDipal Arora
 
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...daisycvs
 

KĂŒrzlich hochgeladen (20)

The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai KuwaitThe Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
 
Falcon's Invoice Discounting: Your Path to Prosperity
Falcon's Invoice Discounting: Your Path to ProsperityFalcon's Invoice Discounting: Your Path to Prosperity
Falcon's Invoice Discounting: Your Path to Prosperity
 
Call Girls From Pari Chowk Greater Noida ❀8448577510 âŠčBest Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❀8448577510 âŠčBest Escorts Service I...Call Girls From Pari Chowk Greater Noida ❀8448577510 âŠčBest Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❀8448577510 âŠčBest Escorts Service I...
 
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
 
Phases of Negotiation .pptx
 Phases of Negotiation .pptx Phases of Negotiation .pptx
Phases of Negotiation .pptx
 
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
 
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdfDr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
 
Falcon Invoice Discounting: Empowering Your Business Growth
Falcon Invoice Discounting: Empowering Your Business GrowthFalcon Invoice Discounting: Empowering Your Business Growth
Falcon Invoice Discounting: Empowering Your Business Growth
 
JAYNAGAR CALL GIRL IN 98274*61493 ❀CALL GIRLS IN ESCORT SERVICE❀CALL GIRL
JAYNAGAR CALL GIRL IN 98274*61493 ❀CALL GIRLS IN ESCORT SERVICE❀CALL GIRLJAYNAGAR CALL GIRL IN 98274*61493 ❀CALL GIRLS IN ESCORT SERVICE❀CALL GIRL
JAYNAGAR CALL GIRL IN 98274*61493 ❀CALL GIRLS IN ESCORT SERVICE❀CALL GIRL
 
Chandigarh Escorts Service 📞8868886958📞 JustđŸ“Č Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 JustđŸ“Č Call Nihal Chandigarh Call Girl...Chandigarh Escorts Service 📞8868886958📞 JustđŸ“Č Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 JustđŸ“Č Call Nihal Chandigarh Call Girl...
 
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
Call Girls Jp Nagar Just Call 👗 7737669865 👗 Top Class Call Girl Service Bang...
 
It will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayIt will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 May
 
Katrina Personal Brand Project and portfolio 1
Katrina Personal Brand Project and portfolio 1Katrina Personal Brand Project and portfolio 1
Katrina Personal Brand Project and portfolio 1
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Russian Call Girls In Gurgaon ❀8448577510 âŠčBest Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❀8448577510 âŠčBest Escorts Service In 24/7 Delh...Russian Call Girls In Gurgaon ❀8448577510 âŠčBest Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❀8448577510 âŠčBest Escorts Service In 24/7 Delh...
 
Value Proposition canvas- Customer needs and pains
Value Proposition canvas- Customer needs and painsValue Proposition canvas- Customer needs and pains
Value Proposition canvas- Customer needs and pains
 
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabiunwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
 
Famous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st CenturyFamous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st Century
 
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesMysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
 
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
Quick Doctor In Kuwait +2773`7758`557 Kuwait Doha Qatar Dubai Abu Dhabi Sharj...
 

Lecture 4 - Growth of Functions (1).ppt

  • 1. Introduction to Algorithms (3rd edition) by Cormen, Leiserson, Rivest & Stein Chapter 3: Growth of Functions (slides enhanced by N. Adlai A. DePano)
  • 2. Overview ïŻ Order of growth of functions provides a simple characterization of efficiency ïŻ Allows for comparison of relative performance between alternative algorithms ïŻ Concerned with asymptotic efficiency of algorithms ïŻ Best asymptotic efficiency usually is best choice except for smaller inputs ïŻ Several standard methods to simplify asymptotic analysis of algorithms
  • 3. Asymptotic Notation ïŻ Applies to functions whose domains are the set of natural numbers: N = {0,1,2,
} ïŻ If time resource T(n) is being analyzed, the function’s range is usually the set of non- negative real numbers: T(n)  R+ ïŻ If space resource S(n) is being analyzed, the function’s range is usually also the set of natural numbers: S(n)  N
  • 4. Asymptotic Notation ïŻ Depending on the textbook, asymptotic categories may be expressed in terms of -- a. set membership (our textbook): functions belong to a family of functions that exhibit some property; or b. function property (other textbooks): functions exhibit the property ïŻ Caveat: we will formally use (a) and informally use (b)
  • 5. The Θ-Notation f c1 ⋅ g n0 c2 ⋅ g Θ(g(n)) = { f(n) : ∃c1, c2 > 0, n0 > 0 s.t. ∀n ≄ n0: c1 · g(n) ≀ f(n) ≀ c2 ⋅ g(n) }
  • 6. The Ω-Notation Ω(g(n)) = { f(n) : ∃c > 0, n0 > 0 s.t. ∀n ≄ n0: f(n) ≄ c ⋅ g(n) } f c ⋅ g n0
  • 7. The O-Notation f c ⋅ g n0 O(g(n)) = { f(n) : ∃c > 0, n0 > 0 s.t. ∀n ≄ n0: f(n) ≀ c ⋅ g(n) }
  • 8. The o-Notation o(g(n)) = { f(n) : ∀c > 0 ∃n0 > 0 s.t. ∀n ≄ n0: f(n) ≀ c ⋅ g(n) } f c1 ⋅ g n1 c2 ⋅ g c3 ⋅ g n2 n3
  • 9. The ω-Notation f c1 ⋅ g n1 c2 ⋅ g c3 ⋅ g n2 n3 ω(g(n)) = { f(n) : ∀c > 0 ∃n0 > 0 s.t. ∀n ≄ n0: f(n) ≄ c ⋅ g(n) }
  • 10. ïŻ f(n) = O(g(n)) and g(n) = O(h(n)) ⇒ f(n) = O(h(n)) ïŻ f(n) = Ω(g(n)) and g(n) = Ω(h(n)) ⇒ f(n) = Ω(h(n)) ïŻ f(n) = Θ(g(n)) and g(n) = Θ(h(n)) ⇒ f(n) = Θ(h(n)) ïŻ f(n) = O(f(n)) f(n) = Ω(f(n)) f(n) = Θ(f(n)) Comparison of Functions Reflexivity Transitivity
  • 11. ïŻ f (n) = Θ(g(n))  g(n) = Θ(f (n)) ïŻ f (n) = O(g(n))  g(n) = Ω(f (n)) ïŻ f (n) = o(g(n))  g(n) = ω(f (n)) ïŻ f (n) = O(g(n)) and f (n) = Ω(g(n))  f (n) = Θ(g(n)) Comparison of Functions Transpose Symmetry Symmetry Theorem 3.1
  • 12. Standard Notation and Common Functions ïŻ Monotonicity A function f(n) is monotonically increasing if m ï‚Ł n implies f(m) ï‚Ł f(n) . A function f(n) is monotonically decreasing if m ï‚Ł n implies f(m) ï‚ł f(n) . A function f(n) is strictly increasing if m < n implies f(m) < f(n) . A function f(n) is strictly decreasing if m < n implies f(m) > f(n) .
  • 13. Standard Notation and Common Functions ïŻ Floors and ceilings For any real number x, the greatest integer less than or equal to x is denoted by x. For any real number x, the least integer greater than or equal to x is denoted by xïƒč. For all real numbers x, x1 < x ï‚Ł x ï‚Ł xïƒč < x+1. Both functions are monotonically increasing.
  • 14. Standard Notation and Common Functions ïŻ Exponentials For all n and aï‚ł1, the function an is the exponential function with base a and is monotonically increasing. ïŻ Logarithms Textbook adopts the following convention lg n = log2n (binary logarithm), ln n = logen (natural logarithm), lgk n = (lg n)k (exponentiation), lg lg n = lg(lg n) (composition), lg n + k = (lg n)+k (precedence of lg).
  • 15. Standard Notation and Common Functions ïŻ Factorials For all n the function n! or “n factorial” is given by n! = n ï‚Ž (n1) ï‚Ž (n  2) ï‚Ž (n  3) ï‚Ž 
 ï‚Ž 2 ï‚Ž 1 It can be established that n! = o(nn) n! = (2n) lg(n!) = (nlgn)
  • 16. ïŻ Functional iteration The notation f (i)(n) represents the function f(n) iteratively applied i times to an initial value of n, or, recursively f (i)(n) = n if i=0 f (i)(n) = f(f (i1)(n)) if i>0 Example: If f (n) = 2n then f (2)(n) = f (2n) = 2(2n) = 22n then f (3)(n) = f (f (2)(n)) = 2(22n) = 23n then f (i)(n) = 2in Standard Notation and Common Functions
  • 17. ïŻ Iterated logarithmic function The notation lg* n which reads “log star of n” is defined as lg* n = min {iï‚ł0 : lg(i) n ï‚Ł 1 Example: lg* 2 = 1 lg* 4 = 2 lg* 16 = 3 lg* 65536 = 4 lg* 265536 = 5 Standard Notation and Common Functions
  • 18. ïŻ Asymptotic analysis studies how the values of functions compare as their arguments grow without bounds. ïŻ Ignores constants and the behavior of the function for small arguments. ïŻ Acceptable because all algorithms are fast for small inputs and growth of running time is more important than constant factors. Things to Remember
  • 19. ïŻ Ignoring the usually unimportant details, we obtain a representation that succinctly describes the growth of a function as its argument grows and thus allows us to make comparisons between algorithms in terms of their efficiency. Things to Remember
  • 20. Tips to Help Remember ïŻ May be helpful to make the following “analogies” (remember, we are comparing rates of growth of functions)