Big O Notation in summary 💪
·Sep 22, 2022·
1 min read
O(1) = runs a constant operation once.
O(n) = repeats a constant operation n times.
O(logn) = runs a constant operation on a fraction of the input
n^2 = repeats O(n) n times.
2^n = doubles the current operation by the next operation.
O(1) = an operation with no loop or recursion.
O(n) = an operation with a loop.
O(logn) = binary-search
O(n^2) = 2 nested loops.
O(2^n) = Fibonacci with recursion & without memoization.