Complexity - makstron/info GitHub Wiki
Cheat Sheet
- O(1) Constant - no loops
- O(log N) Logarithmic - usually searching algorithms have log n if they are sorted (Binary Search)
- O(n) Linear - for loops, while loops through n items
- O(n log(n)) Log Linear - usually sorting operations
- O(n^2) Quadratic - every element in a collection needs to be compared to every other element. Two nested loops
- O(2^n) Exponential - recursive algorithms that solve a problem of size N
- O(n!) Factorial - you are adding a loop for every element (Travelling Salesman Problem (Задача комівояжера))
https://www.linkedin.com/pulse/data-structures-revision-muhammad-adnan/