Alright. What did big O teach you... did it tell you how fast something was going to run? no. Big O was a measure of asymptotic complexity... the entire theory of Big O was: for N data items, proportionally, how many steps M will I have to take. What it was designed to tell you was that: If an algorithm of Big O of N took 10 seconds to do 10 items, when we increased the number if items to 20, it would probably take somewhere near 20 seconds.
Comparing two algorithms that have a similar Big O, although it might seem like an intuitive thing to do, is really comparing apples and oranges. Remember, and this should be your mantra: "we are not comparing runtimes, but asymptotic complexity." Let us say that you have two algorithms with a same Big O, let us say of N, and data for them to utilize for size M. Let us say that algorithm 1 takes X time to accomplish it's task, and algorithm 2 takes Y time to accomplish it's task. All that Big O is telling you is that for M*2 datum, algorithm 1 will take X*2 and algorithm 2 will take Y*2! Their rate of CHANGE is what you are looking for (god, is that the 1st derivative?) not their actual values.
Eek... i think that's right... anyone wanna jump in on this one with me?
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|