Aw: Re: Aw: Re: Aw: Re: [stella] Sorting Algorithms.

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 :-)


Riester-Rente - Kassieren Sie das Geld vom Staat:
Zum Förderungsrechner!

Archives (includes files) at
Unsub & more at

Current Thread