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