Asymptotic Notations for Analysis of Algorithms
The main idea of asymptotic analysis is to have a measure of the efficiency of
algorithms. Asymptotic notations are mathematical tools to represent the time
complexity of algorithms for asymptotic analysis.
1. Big-Oh Notation (O-Notation)
Big-O notation represents the upper bound (at most) of the running time of an algorithm. Thus, it
presents the worst-case time (maximum time an algorithm takes) complexity of an algorithm.
It is a widely used notation as compared to others notations. The reason is, if we know the worst-case
value for any algorithm then the average and best may guess easily. For example, if a book has 100
pages and applies a linear sort to find a particular topic, then Big-O tells the particular topic is exist on
the last page (100). It is the worse case.
Mathematical Representation of Big-O Notation:
O(g(n)) = { f(n): there exist positive constants c and n0 such that 0 ≤ f(n) ≤ cg(n) for all n ≥ n0 }
or
If f(n) describes the running time of an algorithm, f(n) is O(g(n)) if there exist a positive constant C
and n0 such that, 0 ≤ f(n) ≤ cg(n) for all n ≥ n0
The graph of Big-Oh, as mentioned above, shows
•n is the input size in the x-axis
•t is time in the y-axis
•f(n) is a function for a particular problem that is always given.
•g(n) is the notation of Big-Oh, where c is constant and g(n) is the Big-Oh function.
Then f(n) = O(c.g(n))
Examples Of Big-Oh Notation
Example 01: If we want to represent given function f (n) = 2n +3 in terms of Big-O [c.g(n)] then
Example 01: If we want to represent given function f (n) = 2n +3 in terms of Big-O [c.g(n)] then
Solution:
2. Omega Notation (Ω-Notation)
Omega notation represents the lower bound (at least) of the running time of an algorithm. So, it provides
the best case time (minimum time an algorithm takes) complexity of an algorithm.
For example, if a book has 100 pages and applies a linear sort to find a particular topic, then Big-Omega
tells the particular topic is exist at first page (1). It is best case.
Let’s look at the proper definition
Let F(n) and g(n) be two non-negative functions then there exist the following rules
•n0>0
•C>0
•F(n) ≥g(n), ∀ n ≥ n0
Then f(n) = Ω(C.g(n))
Examples Of Omega Notation
Example 01: If we want to represent given function f (n) = 2n +3 in terms of Big-Omega [c.g(n)] then
•2n +3 ≥ c.n // purpose of selecting “n” of “g(n)” means always choose the closet lower bound to
satisfy the equation.
•2n +3 ≥ 1n // put constant C=1 to satisfy equation.
•For all n ≥ n0 // Put different values of n and check the results, results will be according to given rules
of Big – Omega as given under
Above example will also be true for all those values of function g(n) which are less than “n” (i.e. 1, nlogn
etc). So, function time complexity will be (O(1), … O(nlogn)). But we choose the lower-bound value
closest to the given function.
Solution: Solution of Example 1 is explained in the following figure
3. Theta Notation (Θ-Notation)
Theta notation represents the upper and lower bound of the running time of an algorithm. It calculates
the average-case time complexity of an algorithm.
For example, if a book has 100 pages and applies a linear sort to find a particular topic, Theta tells the
particular topic is exist on the last page (50). It is an average case.
Analogy: Carrying Groceries
1.π π :The actual number of grocery items you buy on a shopping trip.
→ This is the algorithm’s actual workload.
2.π π :The capacity of one standard shopping bag (say it can hold 10
items). → This is the benchmark growth rate we compare against.
3.π: A multiplier for bag capacity. → Maybe you don’t just use one bag —
you allow yourself up to 3 bags. So the upper bound becomes π ⋅ π π
= 3 × 10 = 30items.
4.π0 :The minimum shopping size after which the rule applies. → If you
only buy 1 or 2 items, the rule doesn’t matter. But once you’re buying
enough groceries (π0 ,(the comparison holds.
Explaining Big O with Grocery Bags
1.Imagine you go shopping every week, and each time you buy a certain number of items. The number of items you buy
is like π π —it represents the actual workload of your algorithm.
2.Now, think of a standard shopping bag that can hold exactly 10 items. This bag capacity is like π π —it’s the
benchmark function we use for comparison.
3.If you only ever bought fewer than 10 items, then we could say π π ≤ π π .But in reality, sometimes you buy 15
items, sometimes 20, sometimes 25. Clearly, one bag is not enough to describe your shopping pattern.
4.To make the comparison fair, we allow ourselves to use multiple bags. This is where the constant πcomes in. If π = 3,
then we can carry up to 3 × 10 = 30items. So instead of saying “your shopping must fit in one bag,” we say “your
shopping must fit in some fixed number of bags.”
5.Notice that the number of bags doesn’t grow with the number of items — it’s just a constant multiplier. Whether you
buy 50 items or 500, we only care that your shopping fits within a fixed multiple of the standard bag size.
6.This is exactly what Big O notation does. It doesn’t demand that π π be less than π π itself. Instead, it says: “There
exists some constant πsuch that π π will always be less than or equal to π ⋅ π π once πis large enough.”
7.The threshold π0 is like saying: “We only start applying this rule once your shopping trips are big enough.” If you only
buy 1 or 2 items, the rule doesn’t matter. But once you’re buying in bulk, the comparison becomes meaningful.
8.In simple words: Big O notation is about bounding growth. It tells us that no matter how many items you buy, your
shopping will always fit into some fixed number of bags — it won’t suddenly require an infinite number of bags.
9.This analogy helps students see why we multiply by π. Without π, we would unfairly restrict ourselves to just one bag.
With π, we allow flexibility while still keeping the growth under control.
10.So the takeaway is: π π is the standard bag size, π ⋅ π π is the scaled bag capacity, and π π is your actual
shopping. Big O says your shopping will always fit into some fixed number of bags once it gets large enough.
Advantages of Asymptotic Notations
Machine Independent – They evaluate algorithm efficiency without
depending on hardware or compiler.
1.Scalability – Show how performance grows with input size.
2.Simplified Comparison – Ignore constants and focus on growth rates.
3.Predictive Power – Help estimate performance before implementation.
4.Standardized Language – Provide a universal way to discuss algorithm
efficiency.
Disadvantages/limitation of Asymptotic Notations
1.Ignore Constants – They neglect constant factors which may matter for
small inputs.
2.No Practical Details – Do not account for hardware, memory hierarchy, or
compiler optimizations.
3.Large Input Focus – Only describe behavior for very large inputs, not small
or medium cases.
4.Abstract Nature – Provide theoretical analysis, not actual running time.
Problems