Article View: rec.games.programmer
Article #1043Re: Advice needed for fastest sort algorthm
From: Kristof Roomp
Date: Tue, 10 Nov 1992 01:12
Date: Tue, 10 Nov 1992 01:12
14 lines
1494 bytes
1494 bytes
In article <1992Nov8.012628.23338@menudo.uh.edu> libh@Jane.UH.EDU writes: > The bubble sort takes N! (# factorial) steps, rather than N*N steps. A BIG >difference. But as pointed out, the quicksort is the easiest to implement >since it is in C libraries. Why reinvent the wheel. If that isn't quick >enough then I would check out Knuth's 'Art of Programming' Vol. 3 since it is >pretty much only about sorting. > nope.its worst case is n*n where n is the number of items in the list... you have to watch the quicksort with lists of objects which are already sorted, because its performance on a sorted list is a lot worse than the bubble sort. on a presorted list , the quicksort will also use in the order of n stack space. This could be prevented by taking a different pivot element when quicksorting (like the middle one). the library quicksort uses the first element.
Technical Details
Message-ID:
<1992Nov10.011231.19813@softwords.bc.ca>Path:
arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ames!elroy.jpl.nasa.gov!swrinde!emory!sol.ctr.columbia.edu!destroyer!cs.ubc.ca!news.UVic.CA!softwords!cue.bc.ca!krisrReferences:
<6759@news.duke.edu> <BxD5pt.DyI@news.cso.uiuc.edu> <1992Nov8.012628.23338@menudo.uh.edu>Show Full Headers
Complete Article Headers
Newsgroups: rec.games.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!sun-barr!ames!elroy.jpl.nasa.gov!swrinde!emory!sol.ctr.columbia.edu!destroyer!cs.ubc.ca!news.UVic.CA!softwords!cue.bc.ca!krisr From: krisr@cue.bc.ca (Kristof Roomp) Subject: Re: Advice needed for fastest sort algorthm Message-ID: <1992Nov10.011231.19813@softwords.bc.ca> Sender: news@softwords.bc.ca (CNews) Nntp-Posting-Host: cue.bc.ca Organization: Computer Using Educators of B.C., Canada References: <6759@news.duke.edu> <BxD5pt.DyI@news.cso.uiuc.edu> <1992Nov8.012628.23338@menudo.uh.edu> Date: Tue, 10 Nov 92 01:12:31 GMT Lines: 17