0% found this document useful (0 votes)
45 views25 pages

Lecture4 (Asymptotic Notations)

This document discusses asymptotic notations, which are used to analyze the efficiency of algorithms and compare how fast functions grow relative to input size. It introduces the notations of big-O (O), big-Omega (Ω), and big-Theta (Θ) to classify functions by their order of growth. Common time complexities are classified, with constant functions as the most efficient and exponential or factorial functions as the least efficient. Limits, L'Hopital's rule, and Stirling's formula are covered as ways to establish the order of growth for functions. Examples are provided to illustrate the notations and efficiency classes.

Uploaded by

avinash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views25 pages

Lecture4 (Asymptotic Notations)

This document discusses asymptotic notations, which are used to analyze the efficiency of algorithms and compare how fast functions grow relative to input size. It introduces the notations of big-O (O), big-Omega (Ω), and big-Theta (Θ) to classify functions by their order of growth. Common time complexities are classified, with constant functions as the most efficient and exponential or factorial functions as the least efficient. Limits, L'Hopital's rule, and Stirling's formula are covered as ways to establish the order of growth for functions. Examples are provided to illustrate the notations and efficiency classes.

Uploaded by

avinash
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 25

CSE408

Asymptotic notations
Lecture #4
Asymptotic Notations

• The efficiency analysis framework concentrates on the order of


growth of an algorithm’s basic operation count as the principal
indicator of the algorithm’s

• To compare and rank such orders of growth, computer


scientists use three notations:(big oh), (big omega), and (big
theta)efficiency
O Notation
Example
Big omega Notation
Example
Theta Notation
Example
Asymptotic order of growth

A way of comparing functions that ignores constant factors and small


input sizes

• O(g(n)): class of functions f(n) that grow no faster than g(n)

• Θ(g(n)): class of functions f(n) that grow at same rate as g(n)

• Ω(g(n)): class of functions f(n) that grow at least as fast as g(n)


Big-oh
Big-omega
Theta
Some properties of asymptotic order of growth

• f(n)  O(f(n))

• f(n)  O(g(n)) iff g(n) (f(n))

• If f (n)  O(g (n)) and g(n)  O(h(n)) , then f(n)  O(h(n))

Note similarity with a ≤ b

• If f1(n)  O(g1(n)) and f2(n)  O(g2(n)) , then


f1(n) + f2(n)  O(max{g1(n), g2(n)})
Establishing order of growth using limits

0 order of growth of T(n) < order of growth of g(n)

c > 0 order of growth of T(n) = order of growth of g(n)


lim T(n)/g(n) =
n→∞
∞ order of growth of T(n) > order of growth of g(n)

Examples:
• 10n vs. n2

• n(n+1)/2 vs. n2
L’Hôpital’s rule and Stirling’s formula

L’Hôpital’s rule: If limn f(n) = limn g(n) =  and


the derivatives f´, g´ exist, then

lim f(n) lim f ´(n)


=
n g(n) n g ´(n)
Example: log n vs.n!n (2n)1/2 (n/e)n
Stirling’s formula:

Example: 2n vs. n!
Exmaple
Example
Example
Example
Small Oh Notation
Small Oh Notation
Exmaple
Orders of growth of some important functions

• All logarithmic functions loga n belong to the same class


(log n) no matter what the logarithm’s base a > 1 is

• All polynomials of the same degree k belong to the same class: aknk
+ ak-1nk-1 + … + a0  (nk)

• Exponential functions an have different orders of growth for


different a’s

• order log n < order n (>0) < order an < order n! < order nn
Basic asymptotic efficiency classes

1 constant

log n logarithmic

n linear

n log n n-log-n

n2 quadratic

n3 cubic

2n exponential

n! factorial
! ! !
ank You
Th

You might also like