0% found this document useful (0 votes)
14 views

Asymptotic Notation

Uploaded by

sriya.21mic7185
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)
14 views

Asymptotic Notation

Uploaded by

sriya.21mic7185
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/ 30

ASYMPTOTIC NOTATION

• The notations are used for representing the symbol form of a function or showing the
class of a function.

• Asymptotic notations are the mathematical notations used to describe running time of an
algorithm when the input tends towards a particular value or limiting value.

• Ex: When the input array is in sorted order, the time taken by the algorithm is linear.

• When the input array is in reverse order, it takes maximum time.


1<log n < (root(n) < n <nlogn <n^2 <n^3 ………………….. 2^n <3^n <…..< n^n
Smaller Greater
TYPES OF NOTATION

• Big Ohh (O)-Upper Bound


• Big Omega (Ω) Lower Bound
• Theta (ϴ ) Average case
• Little Ohh (o)
• Little Omega (w)
BIG OHH (O)-UPPER BOUND

• Big O notation is a mathematical notation that describes the limiting behavior of a


function when the argument tends towards a particular value or infinity/Upper bound of
the running time of an algorithm.
MATHEMATICALLY

C is called Coefficient
F(n) = 2n+3
2n+3<= C. g(n), for all n>=0
Then we called f(n) = O(n)
OR
2n+3<= 2n+3n
2n+3<= 5n, n>= 1
All the above methods are correct, because we are looking for upper
bound conditions.

Q). If all the statements are correct, then which one is appropriate.

Sol: Take the closest function always for analysis.


BIG OMEGA(Ω)
• Big-Omega (Ω) notation gives a lower bound for a function f(n) to within a constant
factor.

• f(n) = Ω(g(n)), If there are positive constants n0 and c such that, to the right of n0 the
f(n) always lies on or above c*g(n).
Ω(g(n)) = { f(n) : There exist positive constant c and n0 such that 0 ≤ c g(n) ≤ f(n), for all n ≤ n 0}
BIG THETA NOTATION

Big-Theta(Θ) notation gives bound for a function f(n) to within a constant factor.

We write f(n) = Θ(g(n)), If there are positive constants n0 and c 1 and c2 such that, to the right of
n0 the f(n) always lies between c1*g(n) and c2*g(n) inclusive.

Θ(g(n)) = {f(n) : There exist positive constant c 1, c2 and n0 such that 0 ≤ c1 g(n) ≤ f(n) ≤ c2 g(n),
for all n ≥ n0}
Q. Find ϴ notation for the function

F(n) = (1/3)n3 +(1/2)n2 +(1/6) n


Q. Find ϴ notation for the function

F(n) = (1/3)n3 +(1/2)n2 +(1/6) n


Q. Find O notation for the function

f(n) = 2n +6n2 +3n

Solution:

2n +6n2 +3n <= 2n +6n2 +n2 <= 2n +7n2

i.e we are showing the function is asymptotically tight by upper bound for 2n >=n2

Where n>= 4

2n +7n2 <= 2n +7n2 * 2n


Q. Is 27n2 +16n +25 =O(n) ?
Q. Find out the O notation for the function 10n2 +7
• Reflexivity Example:
If f(n) = n3 ⇒ O(n3)
Symmetry:

If f(n) = n2 and g(n) = n2 then f(n) = Θ(n2) and g(n) = Θ(n2)


• Transitivity Example

You might also like