# Big O Notation in summary ๐ช

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.

Examples:

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.

ย