home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cis.ohio-state.edu!magnus.acs.ohio-state.edu!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!ames!pasteur!dv349-5a.berkeley.edu!c152-cs
- From: c152-cs@dv349-5a.berkeley.edu (John W. Horigan)
- Newsgroups: comp.lang.c
- Subject: Re: Sort help needed
- Message-ID: <1992Aug14.224950.13669@pasteur.Berkeley.EDU>
- Date: 14 Aug 92 22:49:50 GMT
- References: <3223@dozo.and.nl> <2125@ontek.com> <3225@dozo.and.nl>
- Sender: nntp@pasteur.Berkeley.EDU (NNTP Poster)
- Organization: University of California, Berkeley
- Lines: 27
- Nntp-Posting-Host: dv349-5a.berkeley.edu
-
- In article <3225@dozo.and.nl> jos@and.nl (Jos Horsmeier) writes:
-
- [ stuff about the meaning of sort stability deleted. HS means Heap sort
- and QS means Quick sort. ]
-
- > I just
- >had to say that the _worst case_ behavior of HS is better than the
- >_worst case_ behaviour of QS, i.e. the big Oh still is O(n*log(n))
- >I should have avoided the use of the word `stable'. sorry ...
- >
- >(because of this O(n*log(n)) behavior, even in the worst case,
- > I prefer HS... no religious wars please ;-)
- >
- >kind regards,
- >
- >Jos aka jos@and.nl
-
- But any reasonable implementation of Quick sort will use randomly
- chosen pivots or some other simple, easy to implement pivot selection
- algorithm. With these types of Quick sort algorithms the worst case
- behavior is so _fantastically_ unlikely that with any reasonably
- sized data set you wouldn't see O(n^2) behavior within the lifetime
- of the universe. But heaps are kinda neat... :)
-
- John Horigan
- jhorigan@cook.berkeley.edu
- UC Berkeley, Dept. of Materials Science & Mineral Engineering
-