Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

If g(n) = sqrt(n)^sqrt(n), does the complexity of g(n) = O(2^n)?

If g(n) = sqrt(n)sqrt(n), does the complexity of g(n) = O(2n)?

Any help is appreciated.

like image 761
john rowland Avatar asked Mar 04 '17 21:03

john rowland


People also ask

What is time complexity of sqrt N?

Square root time complexity means that the algorithm requires O(N^(1/2)) evaluations where the size of input is N. As an example for an algorithm which takes O(sqrt(n)) time, Grover's algorithm is one which takes that much time.

Is sqrt n faster than log n?

They are not equivalent: sqrt(N) will increase a lot more quickly than log2(N). There is no constant C so that you would have sqrt(N) < C. log(N) for all values of N greater than some minimum value. So you need to take the logarithm(!) of sqrt(N) to bring it down to the same order of complexity as log2(N).

Is square root faster than log?

Any root function grows faster than any power of the natural log function.

Is N N bigger than N?

n^n grows larger than n!


1 Answers

A useful technique when comparing two exponential functions is to get them to have the same base:

√n√n = (2lg √n)√n = 2√n lg √n

Now you're comparing 2√n lg √n against 2n, and hopefully from that it's easy to see that the former function does not grow as rapidly as the latter, so √n√n = O(2n) is indeed true.

like image 102
templatetypedef Avatar answered Sep 28 '22 04:09

templatetypedef