If an algorithm's input size is 2^n and the algorithm runs in $O(n2^n)$ time. In this case, can we say that the algorithm runs in polynomial time with respect to input size?
1 Answer
Yes, that would be an O(k log k)-time algorithm, where k = 2^n.
3 Comments
NARAYAN CHANGDER
Thanks, @David So, I could say it is a polynomial time or pseudopolynomial? I am confused between these two.
Codor
A good question and a good answer - everything depends on the right definitions; I always found it somewhat puzzling that, for instance, for matrix multiplication algorithms, the runtime bound is usually stated in terms of
n where the input is of size n*n.David Eisenstat
@NARAYANCHANGDER Polynomial. An example of a pseudopolynomial running time is O(k^log k).