I have a homework problem for my algorithms class asking me to calculate the maximum size of a problem that can be solved in a given number of operations using an O(n log n) algorithm (ie: n log n = c). I was able to get an answer by approximating, but is there a clean way to get an exact answer?
Share
There is no closed-form formula for this equation. Basically, you can transform the equation:
Then, this equation has a solution of the form:
where W is Lambert W function (see especially “Example 2”). It was proved that
Wcannot be expressed using elementary operations.However,
f(n)=n*log(n)is a monotonic function. You can simply use bisection (here in python):