svissag@hubcap.clemson.edu (Steve L Vissage II) (11/27/90)
I asked for this once before, but apparently, in all the fervor to put forth a favorite argument for/against N log N, I was ignored. Could someone please give me a brief explanation of the mechanics of the Radix Sort? If available, I'd like source code in C. Thank you, Steve L Vissage II svissag@hubcap.clemson.edu
t901908@mp.cs.niu.edu (Joe Adamo) (11/30/90)
Here's the source code for a Radix Exchange Sort, I hope it'll help :)
radixexchange(int a[], int l, int r, int b)
{
int t, i, j;
if (r>l && b>=0)
{
i = l; j = r;
while (j != i)
{
while (bits(a[i], b, 1) ==0 && i<j) i++;
while (bits(a[i], b, 1) !=0 && j>i) j--;
t = a[i]; a[i] = a[j]; a[j] = t;
}
if (bits(a[r], b, 1) == 0) j++;
radixexchange(a, l, j-1, b-1);
radixexchange(a, j, r, b-1);
}
}
where bits =
bits(unsigned x, int k, int j)
{
return(x >> k) & ~(~0 << j);
}
**Northern Illinois University. A nice place to visit but....