Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's my attempt:</p> <p>A function, <code>f(n)</code> is <code>O(n)</code>, if and only if there exists a constant, <code>c</code>, such that <code>f(n) &lt;= c*g(n)</code>.</p> <p>Using this definition, could we say that the function <code>f(2^(n+1))</code> is <code>O(2^n)</code>?</p> <ol> <li><p>In other words, does a constant <code>'c'</code> exist such that <code>2^(n+1) &lt;= c*(2^n)</code>? Note the second function (<code>2^n</code>) is the function after the Big O in the above problem. This confused me at first.</p></li> <li><p>So, then use your basic algebra skills to simplify that equation. <code>2^(n+1)</code> breaks down to <code>2 * 2^n</code>. Doing so, we're left with:</p> <p><code>2 * 2^n &lt;= c(2^n)</code></p></li> <li><p>Now its easy, the equation holds for any value of <code>c</code> where <code>c &gt;= 2</code>. So, yes, we can say that <code>f(2^(n+1))</code> is <code>O(2^n)</code>.</p></li> </ol> <p>Big Omega works the same way, except it evaluates <code>f(n)</code> <strong>>=</strong> <code>c*g(n)</code> for some constant <code>'c'</code>.</p> <p>So, simplifying the above functions the same way, we're left with (note the >= now):</p> <p><code>2 * 2^n &gt;= c(2^n)</code></p> <p>So, the equation works for the range <code>0 &lt;= c &lt;= 2</code>. So, we can say that <code>f(2^(n+1))</code> is Big Omega of <code>(2^n)</code>.</p> <p>Now, since BOTH of those hold, we can say the function is Big Theta (<code>2^n</code>). If one of them wouldn't work for a constant of <code>'c'</code>, then its not Big Theta.</p> <p>The above example was taken from the Algorithm Design Manual by Skiena, which is a fantastic book.</p> <p>Hope that helps. This really is a hard concept to simplify. Don't get hung up so much on what <code>'c'</code> is, just break it down into simpler terms and use your basic algebra skills. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload