A handy table with common function structures and their algorithmic complexities:
Big O notation | Name | Sample |
---|---|---|
O(1) | Constant | Dictionary or object access |
O(log 1) | Logarithmic | Binary search |
O(n) | Linear | Loop |
O(n log n) | Linerithmic | Loop * binary search |
O(n^2) | Quadratic | Two nested loops |
O(n^k) | Polinomial | k nested loops |
O(2^n) | Exponential | Recursion |
O(n!) | Factorial | Recursion within a loop |
For detailed info click here