Newsgroups: comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!newsstand.cit.cornell.edu!portc01.blue.aol.com!cliffs.rs.itd.umich.edu!howland.erols.net!usc!news.isi.edu!gremlin!shomase!jbarnett
From: jbarnett@nrtc.northrop.com (Jeff Barnett)
Subject: Re: Mergesort: why's it efficient?
Message-ID: <E2qKwv.9C8@gremlin.nrtc.northrop.com>
Sender: news@gremlin.nrtc.northrop.com (Usenet News Manager)
Reply-To: jbarnett@nrtc.northrop.com
Organization: Northrop Automation Sciences Laboratory
References: <591rqs$hmo@news.nyu.edu> <595atr$bt7@bert.traverse.com>
Date: Fri, 20 Dec 1996 23:50:55 GMT
Lines: 22

In article <595atr$bt7@bert.traverse.com>, oliver@co.traverse.com (Christopher Oliver) writes:
|> Marc Schwarz (schwarz@barney.cs.nyu.edu) wrote:
|> : You might be confusing heapsort with something else.
|> : According to Sedgewick's book, "Algorithms," heapsort is, on 
|> : average, O(N log N); O(N * N) worst case.
|> 
|> Heh?  What?
|> 
|> : I suggest you take a look at either Sedgewick, or the book,
|> : "Intro to Algorithms" by Corman, Leiserson, and Rivest.
|> 
|> Citing the above (pp 44 & 145-149), heap building runs in O(N)

Unless you or CL+R or SEDg have made a real break through, heap
building takes NlogN just like extraction.  BTW, if you want to
be annal about the whole thing, the times actually more resemble
\sum_{i=1}^{N} i log i.

|> time, and the extraction from the heap runs in O(N log N).  I
|> get the same sort of noise from Knuth too.

Jeff Barnett
