Misuses of the big-O notation
Misuses of the big- notation
Asymptotic analysis is an essential part of computational evaluations. It helps in analyzing algorithms with respect to their input sizes. It is not an exact measure of the running time but rather an approximation of how the time or cost increases with regard to the input size.
This analysis is done based on three cases:
Best case
Average case
Worst case
The analysis is done for three bounds:
Upper bound (big-
) Lower bound (big-
) Tight bound (big-
)
What is big- ?
The big-
A pictorial representation of this is as follows:
What is big- ?
The big-
A pictorial representation of this is as follows:
Problems
The primary problem we face during this is the assignment of
or to an algorithm. People often interchange big- with big- , which changes the meaning of the obtained runtime. Another problem is that big-
is written as . This is considered to be a misuse of the notation since the equality sign is misleading for some algorithms, as it indicates that there exists a symmetry. This symmetry does not exist in reality.
Examples
For the first example, let's take the function:
The bounds for this function are:
, as the upper bound as the tight bound
Let's take the other function as:
The bounds for this function are:
, as the upper bound as the tight bound
The misuse here is that
For the second example, let's take
The above holds and is true but
This shows the relationship is not symmetric.
In terms of the equations, the class of functions with complexity
Note: This issue occurs because we use the notation
, while a better notation would be .
Free Resources