Subject: Aw: Re: Aw: Re: Aw: Re: [stella] Sorting Algorithms. From: cybergoth@xxxxxxxx Date: Mon, 25 Mar 2002 17:47:26 +0100 (MET) |
Hi Greg! > Erik Mooney wrote: > > 3/25/2002 9:18:01 AM, cybergoth@xxxxxxxx wrote: > > Careful here - Classic sorting algorithms are usually defined as > > speed being the number of swaps required. In tightly timed > > 6502 assembly language, the comparisons and looping take a > > quite significant amount of time already. In the example > > of 7, 1, 2, 3, 4, 5, 6, you require n^2 comparisons (actually > > (n-1)^2) to get the 7 to the end of the list. > Actually, the classic bubble sort implementation requires 6 comparisons > to get the 7 into the proper place, then one more pass to notice that > the data is now in sorted order. You compare 7 to 1 and swap it, then 7 > to 2, then 7 to 3, etc. Well, that depends on the sort order. Since Thomas rversed it somewhere at the beginning of the Thread, this was my example for a worst case. Now you sort again the other way round, so the worst case (which is what we were talking about) would now be inserting a zero at the end :-) Greetings, Manuel ----------------------------------------------------------------------- Riester-Rente - Kassieren Sie das Geld vom Staat: Zum Förderungsrechner! http://www.arcor.de/home/redir.php/riesterrente ----------------------------------------------------------------------- ---------------------------------------------------------------------------------------------- Archives (includes files) at http://www.biglist.com/lists/stella/archives/ Unsub & more at http://www.biglist.com/lists/stella/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Aw: Re: Aw: Re: Aw: Re: [stella] So, cybergoth | Thread | [stella] Bubble Sort, Manuel Polik |
Re: Aw: Re: [stella] Sorting Algori, Thomas Jentzsch | Date | Re: Aw: Re: Aw: Re: [stella] Sortin, Erik Mooney |
Month |