Friday, July 09, 2021

Polynomial time and exponential time

 Below are some common Big-O functions while analyzing algorithms.

  • O(1) - constant time
  • O(log(n)) - logarithmic time
  • O((log(n))c) - polylogarithmic time
  • O(n) - linear time
  • O(n2) - quadratic time
  • O(nc) - polynomial time
  • O(cn) - exponential time
  • O(n!) - factorial time

(n = size of input, c = some constant)

Here is the model graph representing Big-O complexity of some functions



O(1) = O(yeah)
O(logn) = O(nice)
O(n) = O(k)
O(n^2) = O(my)
O(2^n) = O(no)
O(n!) = O(mg)
O(n^n) = O(sh*t!)

No comments: