Asymptotic Notation
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.
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.
• 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
Solution:
i.e we are showing the function is asymptotically tight by upper bound for 2n >=n2
Where n>= 4