Search code examples
algorithmbig-oasymptotic-complexity

Which is the bigger order of growth ? (Big-O)


nn or 2n2. I think that the n term will grow faster than the 2 term and the n2 will grow faster than the n term, but overall will the n2 exponent cause the second to grow faster.


Solution

  • Let's get ln from both sides:

    log (n ^ n) = n log n
    log (2 ^ (n ^ 2)) = n ^ 2
    

    Obviously n ^ 2 growths faster than n log n. It means that n ^ n growths faster than 2 ^ (n ^ 2).