Big-O notation provides a way to measure the ‘upper limit’ or the ceiling function for the running time (or storage taken) of an algorithm. Mathematically, it is similar to the asymptotic upper bound.
Formal Definition
Big-O Notation
Note
- = Growth Function
- = Initial n value for which (the ceiling function) starts to overtake
- = Scaling constant for which can overtake If the equation holds, is said to be (‘Big O of’)
Technically, can be any function. , and are all valid big-O functions, but the closest upper bound is the best option.
This definition has the implication that if but , then is always faster than .