Re: [stella] Bubble Sort (Rodnay Zaks Version)

Subject: Re: [stella] Bubble Sort (Rodnay Zaks Version)
From: Thomas Jentzsch <tjentzsch@xxxxxx>
Date: Tue, 26 Mar 2002 11:30:45 +0100
>This is the Rodnay Zaks Bubble Sort (if anybody cares! :)

I do! :-)


>Anyway, hope it helps... i'm not saying it's optimized or 
> anything, but here it is...

Hm, if I understand that correct, he stores the number of 
elements at the beginning of the list. And then he repeats 
going through the *whole* list until no more swaps happen.

Yes, that sorts, but that's no correct Bubble Sort. He needs 
about twice as many compares ((n-1)^2 vs n*(n-1)/2) compares as 
for a correct Bubble Sort implementation.

Sorting has always been a source of (in?)famous errors and 
misunderstandings, even the great R. Zaks failed. :-)

Have fun!	
Thomas




----------------------------------------------------------------------------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/


Current Thread