Ogundiran Ayobami
youTooCanCode

youTooCanCode

Big O Notation in summary 💪

Ogundiran Ayobami's photo
Ogundiran Ayobami
·Sep 22, 2022·

1 min read

Subscribe to my newsletter and never miss my upcoming articles

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.

 
Share this