From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc89c,97188312486d4578 X-Google-Attributes: gidfc89c,public X-Google-Thread: 109fba,baaf5f793d03d420 X-Google-Attributes: gid109fba,public X-Google-Thread: 1014db,6154de2e240de72a X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,97188312486d4578 X-Google-Attributes: gid103376,public From: christian.bau@isltd.insignia.com (Christian Bau) Subject: Re: Teaching sorts [was Re: What's the best language to start with?] Date: 1996/08/22 Message-ID: #1/1 X-Deja-AN: 175663230 sender: news@isltd.insignia.com (Usenet News) references: <01bb8f1b$ce59c820$32ee6fce@timhome2> <4vfk6b$i6h@krusty.irvine.com> organization: Insignia Solutions newsgroups: comp.lang.c,comp.lang.c++,comp.unix.programmer,comp.lang.ada Date: 1996-08-22T00:00:00+00:00 List-Id: In article <4vfk6b$i6h@krusty.irvine.com>, adam@irvine.com (Adam Beneschan) wrote (and I quote him out of context): > Following this viewpoint, when we computer scientists speak of an > algorithm's running time as O(n**2), mathematicians might say > > Running time = K * n**2 * (1 + O(1/n)) > > for some constant K. The point here is that the proportional > difference between the running time and (K * n**2) tends to disappear > as n gets large (hence the O(1/n) term). Some time ago I did some experiments to find out how valuable benchmarks are. All I did was to program the standard method for multiplying two square matrices filled with double values. The number of assembly language instructions executed for matrices of size n x n was something like k1*n*n*n + k2*n*n + k3*n + k4, so you would expect that execution time is a monotonous function of n... On a real computer (PowerMac, no virtual memory, no background processes, nothing that would interfere with execution time), the _number of instructions per second_ did reproducably vary by a factor up to _seven_ when going from n to n+1 (for example, case n = 128 took seven times longer than cases n = 127 and n = 129). So for this computer, and this problem, an execution time of O (n**3) means "less than k*n**3, for some k>0, and for all n >= some n0", and nothing more