0% found this document useful (0 votes)
33 views9 pages

Asymptotic Notation

Uploaded by

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

Asymptotic Notation

Uploaded by

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

Asymptotic Notation

Asymptotic Analysis
• 1<logn<n1/2 < n< nlogn<n2<n3<….<2n<3n<…<nn.
• Asymptotic analysis means studying the behavior of the function
when n -> infinity or very large.
• The order of growth of the running time of an algorithm gives a
simple characterization of the algorithm’s efficiency. It focuses on
the growth rate of the algorithm with respect to the problem size.
• Asymptotic notations are used to describe the asymptotic running
time of an algorithm. These notations are defined in terms of
functions whose domains are the set of natural numbers
N={0,1,2,….N}.
• Asymptotic notation can apply to functions that characterize some
• other aspect of algorithms (the amount of space they use, for
example)
• In asymptotic analysis, we ignore the slow growing terms and also
the co-efficient of the fastest growing term.
Big oh notation
• When we have only an asymptotic upper bound, we use O-notation.
• For a given function g(n), O(g(n)) is defined as the set of functions

• O-notation gives an upper bound on a function, to within a constant


factor.

F(n)= O(g(n)), It merely means that some


constant multiple of g(n) is an asymptotic upper
bound on f(n), with no claim about how tight
an upper bound it is.
It means the running time f(n) grows no faster
than a constant times g(n).
• Example
• 3n+4 = O(n)
3n+4 ≤ cn ∀n ≥ n0
let c = 4
3n+4 ≤ 4n ∀n ≥ n0
4≤n ∀n ≥ n0
n0=4
Thus it's proven that 3n+4 is O(n).
Theta Notation
• For a given function g(n), we denote by Θ(g(n)) the set of
functions

• c1, c2, and n0 are positive constants.


• 20n2+17n+9 belongs to Θ(n2)

• Θ is an asymptotically tight bound on


the running time.
"Tight bound" means the running time is
within a constant factor above and below.
• C1 =3, C2 = 4
Omega Notation

For all values n at or to the right of n0, the


value of f (n) is on or above cg(n).
Properties
• Reflexive
• If f(n) is given then f(n) is O(f(n)). Since maximum value of f(n) will
be f(n) ITSELF !
• Similarly this property satisfies for both Θ and Ω notation.
• Symmetric
• If f(n) is Θ(g(n)) then g(n) is Θ(f(n)) . This property only satisfies for Θ
notation.
• f(n) = θ(g(n)) ⇒ g(n) = θ(f(n))
• c1.g(n) ≤ f(n) ≤ c2.g(n) for all n ≥ no -> 1/c2.f(n) ≤ g(n) ≤ 1/c1.f(n)
• g(n) = θ(f(n)) ⇒ f(n) = θ(g(n))
• c1.f(n) ≤ g(n) ≤ c2.f(n) for all n ≥ no
• 1/c2.g(n) ≤ f(n) ≤ 1/c1.g(n)
• Transitivity
• f(n) = O(g(n)) and g(n) = O(h(n)) ⇒ f(n) = O(h(n))
• Theta and omega also satisfy this property.
• f(n) ≤ c1.g(n) ⇒ g(n) ≤ c2.h(n) ⇒ f(n) ≤ c1.c2h(n) ⇒ f(n) ≤ c.h(n),
where, c = c1.c2
• Transpose Symmetry
• f(n) = O(g(n)) if and only if g(n) = Ω(f(n))
• f(n) ≤ c.g(n) for some positive constant c ⇒ g(n) ≥ 1/c.f(n) By the
definition of Omega (Ω) , g(n) = Ω(f(n))
• g(n) = Ω(f(n)) ⇒ f(n) = O(g(n))
• g(n) ≥ c.f(n) By the definition of Omega (Ω)
• ⇒ f(n) ≤ 1/c.g(n)
• By the definition of Big-Oh(O) , f(n) = O(g(n))

You might also like