Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>Why we use big-O so much compared to Theta and Omega:</strong> This is partly cultural, rather than technical. It is extremely common for people to say big-O when Theta would really be more appropriate. Omega doesn't get used much in practice both because we frequently are more concerned about upper bounds than lower bounds, and also because non-trivial lower bounds are often much more difficult to prove. (Trivial lower bounds are usually the kind that say "You have to look at all of the input, so the running time is at least equal to the size of the input.")</p> <p>Of course, these comments about lower bounds also partly explain Theta, since Theta involves both an upper bound and a lower bound.</p> <p><strong>Coming up with a recurrence relation:</strong> There's no simple recipe that addresses all cases. Here's a description for relatively simple recursive algorithmms.</p> <p>Let N be the size of the initial input. Suppose there are R recursive calls in your recursive function. (Example: for mergesort, R would be 2.) Further suppose that all the recursive calls reduce the size of the initial input by the same amount, from N to M. (Example: for mergesort, M would be N/2.) And, finally, suppose that the recursive function does W work <em>outside of the recursive calls.</em> (Example: for mergesort, W would be N for the merge.)</p> <p>Then the recurrence relation would be T(N) = R*T(M) + W. (Example: for mergesort, this would be T(N) = 2*T(N/2) + N.)</p>
 

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