Asymptotic Notation
This note is part of my learning notes on Data Structures & Algorithms.
Asymptotic Notation
Asymptotic notations are mathematical notations used to describe the limiting behavior of a function as its argument approaches infinity or some other limiting value. They are commonly used to analyze the time complexity (time required) or space complexity (memory required) of algorithms. They are also convenient for describing the worst-case running-time function .
Big O Notation
Big O notation describes an upper bound on the time complexity of an algorithm. It provides an asymptotic upper limit for the growth rate of a function as the input size approaches infinity.(worst case)
A function is if there exist positive constants and such that for all ,
Big Omega Notation
Big Omega notation describes a lower bound on the time complexity of an algorithm. It provides an asymptotic lower limit for the growth rate of a function as the input size approaches infinity. (best case)
A function is if there exist positive constants and such that for all ,
Big Theta Notation
Big Theta notation describes a tight bound on the time complexity of an algorithm. It provides an asymptotic tight limit for the growth rate of a function as the input size approaches infinity. (average case)
A function is if and only if is both and . That is, there exist positive constants , and such that for all ,
Visual Representations
Example 1.
Given a function , prove that is .
Find constants and such that for all ,
We can choose and after inspecting the function.
For
Hence, is with and .
Example 2.
Given the function , prove that is .
Find constants and such that for all ,
We can choose and after inspecting the function.
For
Hence, is with and .