Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is 2^(2n) = O(2^n)

Tags:

big-o

math

Is 2(n+1) = O(2n)?

I believe that this one is correct because n+1 ~= n.


Is 2(2n) = O(2n)?

This one seems like it would use the same logic, but I'm not sure.

like image 303
JustinY17 Avatar asked Jan 31 '11 21:01

JustinY17


1 Answers

First case is obviously true - you just multiply the constant C in by 2.

Current answers to the second part of the question, look like a handwaving to me, so I will try to give a proper math explanation. Let's assume that the second part is true, then from the definition of big-O, you have:

enter image description here

which is clearly wrong, because there is no such constant that satisfy such inequality.

like image 148
Salvador Dali Avatar answered Sep 20 '22 05:09

Salvador Dali