Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!ux1.cso.uiuc.edu!mp.cs.niu.edu!t901908 From: t901908@mp.cs.niu.edu (Joe Adamo) Newsgroups: comp.lang.misc Subject: Re: Wanted: Explanation or Source Code (C) for Radix Sort Message-ID: <1990Nov29.203709.9857@mp.cs.niu.edu> Date: 29 Nov 90 20:37:09 GMT References: <11849@hubcap.clemson.edu> Organization: Northern Illinois University Lines: 33 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 && ii) 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.... Brought to you by Super Global Mega Corp .com