Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

N*2^N vs N*N Time complexity

Which time complexity is better N*(2^N) or N^2 and why?

N*(2^N)  or N^2

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

N*(2^N) is exponential.

If you take n=10, for example, you get 10240

N^2 is merely polynomial.

If you take n=10, for example, you get 100

Exponential is worse than polynomial for large N, and even for reasonable Ns, in your case. To see it intuitively, imagine growing N by 1. In the polynomial case, the result grows by a fraction ((N+1) / N) ^ 2. It grows, but not much. In the exponential case, growing N by 1 doubles the result.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading