0% found this document useful (0 votes)
9 views11 pages

Lecture6 Asymptotic Notations

Uploaded by

Bakunzi Daniel
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)
9 views11 pages

Lecture6 Asymptotic Notations

Uploaded by

Bakunzi Daniel
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/ 11

Asymptotic Notations

Asymptotics
• method of describing limiting behavior.
• What are the properties of f (n) as n
becomes very large.
• If f(n) = n2 + 3n, then as n becomes very
large, the term 3n becomes insignificant
compared to n2.
• f(n) is said to be "asymptotically
equivalent to n2, as n → ∞".
Computation Time
• 5n3+4n+3
– Leave the lower order terms 4n+3
– Leave coefficient of leading term 5 in 5n3
– Express the computing time as O(n3)called big Oh
• Let f(n) and g(n) be functions from positive integers to
positive reals. We say f = O(g) (which means that “f
grows no faster than g”) if there is a constant c > 0
such that
f(n) ≤ c*g(n). 5n3+4n+3 ≤6n3
• F is the lower bound and g is the upper bound
Big O
• f1(n) = n2 and f2(n) = 2n + 20
• assuming that these are the computing times
of two algorithms doing the same task, which
is better?
• For n≤5, f1 is smaller; thereafter, f2 is the clear
winner
• This superiority is captured by the big-O
notation: f2 = O(f1); f2 is less than f1
Big O
• f(n)=3n+2
• g(n)=4n
• Such that f(n) is less than g(n) for all n from no
• So f(n) is O(g(n)); f(n)≤C*g(n) for all n from no
• Big O is upper bound of the computing time
6n - 12
t

tmin = 3
3
Cross Over

-12
Omega Ω
• if f(n) is O(g(n)); f(n)≤C*g(n) for all n
from no
• Then f(n) is Ω(g(n)); f(n)≥C*g(n) for all
n from no
• which means that “f grows faster than
g”)
Theta Θ (Average Case)
• C1*g(n) ≤ f(n)≤C2*g(n)
Commonsense rules to simplify rules

1. Multiplicative constants can be omitted: 14n2


becomes n2.
2. na dominates nb if a > b: for instance, n2
dominates n.
3. Any exponential dominates any polynomial: 3n
dominates n5 (it even dominates 2n).
4. Likewise, any polynomial dominates any
logarithm: n dominates (log n)3. This also
means, for example, that n2 dominates nlog n.
Big-Q as an Equivalence Relation
The most common classes are given names:
Q(1) constant
Q(ln(n)) logarithmic
Q(n) linear
Q(n ln(n)) “n log n”
Q(n2) quadratic
Q(n3) cubic
2n, en, 4n, ... exponential
Reading exercise
• Identify an appropriate algorithm;
a) Determine the execution time equation
b) Determine the Big O, Omega and Theta
notations.
c) Determine the nature of the data sets that
make the algorithm to have best case, worst
case and average case.

You might also like