# Asymptotic Notation

## Analysis of Asymptotic Notation

The performance of an algorithm is contingent upon factors like execution time, memory usage, and other resource requirements. To gauge and assess this efficiency, Asymptotic Notation are employed. It’s worth noting that an algorithm’s performance may vary when applied to diverse input types. As the input size expands, this performance is subject to alteration.

Asymptotic analysis is the field of study dedicated to understanding how an algorithm’s performance evolves in response to changes in the scale of the input size.

**Asymptotic Notation : Definition
**

**Asymptotic notations** serve as mathematical symbols employed to characterize how an algorithm’s runtime behaves as the input size approaches a specific or limiting value.

To illustrate this, consider bubble sort:

- When the input array is in an already sorted state, the algorithm completes its task in linear time, denoting the best-case scenario.
- Conversely, when the input array is in reverse order, the algorithm requires the maximum time, adhering to a quadratic time complexity, which represents the worst-case scenario.
- In situations where the input array is neither sorted nor in reverse order, the algorithm exhibits an average runtime. These various performance scenarios are succinctly represented using asymptotic notations.

**Types of Asymptotic Notation**

There are mainly three types of Asymptotic Notation :

**Big-O Notation****Omega Notation****Theta Notation**

**
****Big-O Notation (O-Notation)**

**Big-O Notation (O-Notation)**

Big O notation is used to describe the upper bound or worst-case scenario of an algorithm’s time or space complexity.

- The expression above can be interpreted as follows: A function f(n) is considered to belong to the set O(g(n)) if there exists a positive constant c such that, for sufficiently large values of n, f(n) remains bounded between 0 and cg(n).
- In simpler terms, for any given value of n, the algorithm’s running time will never exceed the time specified by O(g(n)). This notation is particularly valuable for analyzing algorithms because it focuses on the worst-case scenario, helping us understand how an algorithm performs in its most challenging situations.

**
****Omega Notation**

**Omega Notation**

Omega notation describes the lower bound or best-case performance of an algorithm.

- The expression mentioned can be understood as follows: A function f(n) is considered to be a part of the set Ω(g(n)) if there exists a positive constant c such that, for sufficiently large values of n, f(n) remains higher than cg(n).
- In simpler terms, for any given value of n, the algorithm’s minimum required time will be at least as much as what’s specified by the Omega Ω(g(n)) notation.

**
****Theta Notation**

**Theta Notation**

Theta notation provides a precise and balanced description of an algorithm’s behavior, considering both the upper and lower bounds.

- The expression above can be explained as follows: A function f(n) is considered to be within the set Θ(g(n)) if there are positive constants c1 and c2 such that, for sufficiently large values of n, f(n) is sandwiched between c1g(n) and c2g(n).
- In simpler terms, if for all n greater than or equal to some specific value n0, the function f(n) falls within the range defined by c1g(n) and c2g(n), then we say that f(n) has an asymptotically tight bound represented by Θ(g(n)).

**
****Properties of Asymptotic Notation**

**Properties of Asymptotic Notation**

**Common Asymptotic Notation**

constant | O(1) |

logarithmic | O(log n) |

linear | O(n) |

n log n | O(n log n) |

quadratic | O(n^2) |

cubic | O(n^3) |

polynomial | n^[O(1)] |

exponential | 2^[O(n)] |

**To Wrap up with: **

In conclusion, The key notations—Big O, Omega, Theta, and Little O—each have their unique roles in characterizing algorithmic behavior, whether it’s identifying worst-case scenarios, best-case performance, or providing tight bounds on efficiency. These notations simplify algorithmic analysis, aid in making informed decisions when selecting algorithms, and are essential for evaluating the scalability and performance of software systems.

### Prime Course Trailer

### Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

**Get over 200+ course One Subscription**

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others

Login/Signup to comment