One of the most important aspects of algorithms is how quickly they grow. The quicker the growth, the better.
Here is a list of function types in order of their growth:
- Constant functions
- Logarithmic functions
- Linear functions
- Linearithmic functions
- Polynomial functions
- Exponential functions
Big-O Notation is a way to describe the growth, complexity and performance of an algorithm. The strongest notation we can make about binary search is that it runs in O(lgn) time. Because big-O notation gives only an asymptotic upper bound certain technical generalizations can be made and will be considered correct. Big O specifically calculates the worst-case scenario, and can be used to describe the run time or the space required by an algorithm.