Search code examples
algorithmperformanceoptimizationbig-oasymptotic-complexity

Big O or Big Omega?


Here's my answers to Is A O or Ω of B ? Do you think I got it right?

A               B           O   Ω
(log n)^3       N           No  Yes
2n^2+4n         4n^2        Yes No
n!              2^n         No  Yes
n^5             n^4         No  Yes
100             10000       Yes No
n^2             (1.5)^n     No  Yes

Solution

  • Big O is asymptotically upper bound while Big Omega is asymptotically lower bound.

    • A = O(B) if and only if limit A(n)/B(n) < C as n approach infinity and C is a positive constant.
    • A = Ω(B) if and only if limit A(n)/B(n) > C > 0 as n approach infinity and C is a positive constant.

    You can use Wolframe Alpha to find such limit.

    A               B           O   Ω
    (log n)^3       N           Yes  No
    2n^2+4n         4n^2        Yes Yes
    n!              2^n         No  Yes
    n^5             n^4         No  Yes
    100             10000       Yes Yes
    n^2             (1.5)^n     Yes  No
    

    For example: