3

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 1

6

Yes, that would be an O(k log k)-time algorithm, where k = 2^n.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks, @David So, I could say it is a polynomial time or pseudopolynomial? I am confused between these two.
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.
@NARAYANCHANGDER Polynomial. An example of a pseudopolynomial running time is O(k^log k).

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.