Big O (Time Complexity)
Big O Notation | Name | Example |
O(1) | Constant | Choosing one item by index from an array, no matter how long the array it will be the same. |
O(log n) | Logarithmic | Binary search, because every time a comparison is made it is more likely that the search is complete. The search area is halved each time. |
O(n) | Linear | Summing all elements in an array, because each element needs to be checked once so it will increase linearly with the size of the array (n). |
O(n log n) | Linearithmic | |
O(n^2) | Quadratic | |
O(n^3) | Cubic | |
O(2^n) | Exponential | |
O(n!) | Factorial |
Discussion
Reference
https://www.happycoders.eu/algorithms/big-o-notation-time-complexity/