Difference between revisions of "TADM2E 2.7"

From Algorithm Wiki
Jump to: navigation, search
(Recovering wiki)
 
(Recovering wiki)
 
Line 1: Line 1:
 
True or False?
 
True or False?
==Is <math>2^{n+1} = O (2^n)</math>?==
+
==Is <math>2^{n+1} = O (2^n)</math>?==
  
 
True
 
True
Line 6: Line 6:
 
''Proof'':
 
''Proof'':
  
&lt;math&gt;2^{n+1}=2 \times 2^n&lt;/math&gt;,
+
<math>2^{n+1}=2 \times 2^n</math>,
  
&lt;math&gt;2^{n+1} \le 2 \times 2^n&lt;/math&gt;,
+
<math>2^{n+1} \le 2 \times 2^n</math>,
  
&lt;math&gt;2^{n+1} \le C \times 2^n&lt;/math&gt; (where &lt;math&gt;C=2&lt;/math&gt;),
+
<math>2^{n+1} \le C \times 2^n</math> (where <math>C=2</math>),
  
 
Thus:
 
Thus:
&lt;math&gt;2^{n+1} = O (2^n)&lt;/math&gt;.
+
<math>2^{n+1} = O (2^n)</math>.
  
In fact, &lt;math&gt;2^n = O(2^{n+1})&lt;/math&gt; as well, because &lt;math&gt;2^n \le 2^{n+1}&lt;/math&gt;, thus &lt;math&gt;2^n \le C \times 2^{n+1}&lt;/math&gt; (where &lt;math&gt;C=1&lt;/math&gt;).
+
In fact, <math>2^n = O(2^{n+1})</math> as well, because <math>2^n \le 2^{n+1}</math>, thus <math>2^n \le C \times 2^{n+1}</math> (where <math>C=1</math>).
  
==Is &lt;math&gt;2^{2n} = O(2^n)&lt;/math&gt;?==
+
==Is <math>2^{2n} = O(2^n)</math>?==
 
False
 
False
  
 
''Proof'':
 
''Proof'':
  
&lt;math&gt;\lim_{n \to \infty} \frac{2^n}{2^{2n}} = \lim_{n \to \infty} \frac{2^n}{4^n} = \lim_{n \to \infty} (\frac{2}{4})^n = 0&lt;/math&gt;
+
<math>\lim_{n \to \infty} \frac{2^n}{2^{2n}} = \lim_{n \to \infty} \frac{2^n}{4^n} = \lim_{n \to \infty} (\frac{2}{4})^n = 0</math>
  
This means that &lt;math&gt;2^{2n}&lt;/math&gt; is strictly larger than &lt;math&gt;2^n&lt;/math&gt;.
+
This means that <math>2^{2n}</math> is strictly larger than <math>2^n</math>.
  
Thus &lt;math&gt;2^n = o(2^{2n})&lt;/math&gt;, which means that &lt;math&gt;2^n = O(2^{2n})&lt;/math&gt;, though &lt;math&gt;2^{2n} \ne O(2^n)&lt;/math&gt;.
+
Thus <math>2^n = o(2^{2n})</math>, which means that <math>2^n = O(2^{2n})</math>, though <math>2^{2n} \ne O(2^n)</math>.
  
  
 
Return to [[Algo-analysis-TADM2E]] ...
 
Return to [[Algo-analysis-TADM2E]] ...

Latest revision as of 18:23, 11 September 2014

True or False?

Is $ 2^{n+1} = O (2^n) $?

True

Proof:

$ 2^{n+1}=2 \times 2^n $,

$ 2^{n+1} \le 2 \times 2^n $,

$ 2^{n+1} \le C \times 2^n $ (where $ C=2 $),

Thus: $ 2^{n+1} = O (2^n) $.

In fact, $ 2^n = O(2^{n+1}) $ as well, because $ 2^n \le 2^{n+1} $, thus $ 2^n \le C \times 2^{n+1} $ (where $ C=1 $).

Is $ 2^{2n} = O(2^n) $?

False

Proof:

$ \lim_{n \to \infty} \frac{2^n}{2^{2n}} = \lim_{n \to \infty} \frac{2^n}{4^n} = \lim_{n \to \infty} (\frac{2}{4})^n = 0 $

This means that $ 2^{2n} $ is strictly larger than $ 2^n $.

Thus $ 2^n = o(2^{2n}) $, which means that $ 2^n = O(2^{2n}) $, though $ 2^{2n} \ne O(2^n) $.


Return to Algo-analysis-TADM2E ...