<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
radix	B-Algorithm
sort	I-Algorithm
is	O
a	O
non-comparative	O
sorting	B-Algorithm
algorithm	I-Algorithm
.	O
</s>
<s>
For	O
elements	O
with	O
more	O
than	O
one	O
significant	B-Architecture
digit	I-Architecture
,	O
this	O
bucketing	O
process	O
is	O
repeated	O
for	O
each	O
digit	O
,	O
while	O
preserving	O
the	O
ordering	O
of	O
the	O
prior	O
step	O
,	O
until	O
all	O
digits	O
have	O
been	O
considered	O
.	O
</s>
<s>
For	O
this	O
reason	O
,	O
radix	B-Algorithm
sort	I-Algorithm
has	O
also	O
been	O
called	O
bucket	B-Algorithm
sort	I-Algorithm
and	O
digital	O
sort	O
.	O
</s>
<s>
Radix	B-Algorithm
sort	I-Algorithm
can	O
be	O
applied	O
to	O
data	O
that	O
can	O
be	O
sorted	O
lexicographically	O
,	O
be	O
they	O
integers	O
,	O
words	O
,	O
punch	B-Architecture
cards	I-Architecture
,	O
playing	O
cards	O
,	O
or	O
the	O
mail	O
.	O
</s>
<s>
Radix	B-Algorithm
sort	I-Algorithm
dates	O
back	O
as	O
far	O
as	O
1887	O
to	O
the	O
work	O
of	O
Herman	O
Hollerith	O
on	O
tabulating	O
machines	O
.	O
</s>
<s>
Radix	B-Algorithm
sorting	I-Algorithm
algorithms	O
came	O
into	O
common	O
use	O
as	O
a	O
way	O
to	O
sort	O
punched	B-Architecture
cards	I-Architecture
as	O
early	O
as	O
1923	O
.	O
</s>
<s>
The	O
first	O
memory-efficient	O
computer	O
algorithm	O
for	O
this	O
sorting	B-Algorithm
method	O
was	O
developed	O
in	O
1954	O
at	O
MIT	O
by	O
Harold	O
H	O
.	O
Seward	O
.	O
</s>
<s>
Computerized	O
radix	B-Algorithm
sorts	I-Algorithm
had	O
previously	O
been	O
dismissed	O
as	O
impractical	O
because	O
of	O
the	O
perceived	O
need	O
for	O
variable	O
allocation	O
of	O
buckets	O
of	O
unknown	O
size	O
.	O
</s>
<s>
The	O
linear	O
scan	O
is	O
closely	O
related	O
to	O
Seward	O
's	O
other	O
algorithm	O
—	O
counting	B-Algorithm
sort	I-Algorithm
.	O
</s>
<s>
In	O
the	O
modern	O
era	O
,	O
radix	B-Algorithm
sorts	I-Algorithm
are	O
most	O
commonly	O
applied	O
to	O
collections	O
of	O
binary	O
strings	O
and	O
integers	O
.	O
</s>
<s>
It	O
has	O
been	O
shown	O
in	O
some	O
benchmarks	O
to	O
be	O
faster	O
than	O
other	O
more	O
general-purpose	O
sorting	B-Algorithm
algorithms	I-Algorithm
,	O
sometimes	O
50%	O
to	O
three	O
times	O
faster	O
.	O
</s>
<s>
Radix	B-Algorithm
sorts	I-Algorithm
can	O
be	O
implemented	O
to	O
start	O
at	O
either	O
the	O
most	O
significant	B-Architecture
digit	I-Architecture
(	O
MSD	O
)	O
or	O
least	O
significant	B-Architecture
digit	I-Architecture
(	O
LSD	O
)	O
.	O
</s>
<s>
LSD	O
radix	B-Algorithm
sorts	I-Algorithm
typically	O
use	O
the	O
following	O
sorting	B-Algorithm
order	O
:	O
short	O
keys	O
come	O
before	O
longer	O
keys	O
,	O
and	O
then	O
keys	O
of	O
the	O
same	O
length	O
are	O
sorted	O
lexicographically	O
.	O
</s>
<s>
MSD	O
radix	B-Algorithm
sorts	I-Algorithm
are	O
most	O
suitable	O
for	O
sorting	B-Algorithm
strings	O
or	O
fixed-length	O
integer	O
representations	O
.	O
</s>
<s>
LSD	O
sorts	O
can	O
group	O
by	O
length	O
,	O
radix	B-Algorithm
sort	I-Algorithm
each	O
group	O
,	O
then	O
concatenate	O
the	O
groups	O
in	O
size	O
order	O
.	O
</s>
<s>
Each	O
bucket	O
created	O
by	O
an	O
MSD	O
step	O
can	O
itself	O
be	O
radix	O
sorted	O
using	O
the	O
next	O
most	O
significant	B-Architecture
digit	I-Architecture
,	O
without	O
reference	O
to	O
any	O
other	O
buckets	O
created	O
in	O
the	O
previous	O
step	O
.	O
</s>
<s>
Once	O
the	O
last	B-Architecture
digit	I-Architecture
is	O
reached	O
,	O
concatenating	O
the	O
buckets	O
is	O
all	O
that	O
is	O
required	O
to	O
complete	O
the	O
sort	O
.	O
</s>
<s>
Sorting	B-Algorithm
by	O
the	O
next	O
left	O
digit	O
:	O
</s>
<s>
Some	O
radix	B-Algorithm
sort	I-Algorithm
implementations	O
allocate	O
space	O
for	O
buckets	O
by	O
first	O
counting	O
the	O
number	O
of	O
keys	O
that	O
belong	O
in	O
each	O
bucket	O
before	O
moving	O
keys	O
into	O
those	O
buckets	O
.	O
</s>
<s>
First	B-Architecture
digit	I-Architecture
,	O
with	O
brackets	O
indicating	O
buckets	O
:	O
</s>
<s>
Radix	B-Algorithm
sort	I-Algorithm
operates	O
in	O
time	O
,	O
where	O
is	O
the	O
number	O
of	O
keys	O
,	O
and	O
is	O
the	O
key	O
length	O
.	O
</s>
<s>
Optimized	O
radix	B-Algorithm
sorts	I-Algorithm
can	O
be	O
very	O
fast	O
when	O
working	O
in	O
a	O
domain	O
that	O
suits	O
them	O
.	O
</s>
<s>
Binary	O
MSD	O
radix	B-Algorithm
sort	I-Algorithm
,	O
also	O
called	O
binary	O
quicksort	B-Algorithm
,	O
can	O
be	O
implemented	O
in-place	O
by	O
splitting	O
the	O
input	O
array	O
into	O
two	O
bins	O
-	O
the	O
0s	O
bin	O
and	O
the	O
1s	O
bin	O
.	O
</s>
<s>
Recursive	O
processing	O
continues	O
until	O
the	O
least	O
significant	O
bit	O
has	O
been	O
used	O
for	O
sorting	B-Algorithm
.	O
</s>
<s>
Handling	O
signed	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
integers	O
requires	O
treating	O
the	O
most	O
significant	O
bit	O
with	O
the	O
opposite	O
sense	O
,	O
followed	O
by	O
unsigned	O
treatment	O
of	O
the	O
rest	O
of	O
the	O
bits	O
.	O
</s>
<s>
Counting	B-Algorithm
sort	I-Algorithm
is	O
used	O
to	O
determine	O
the	O
size	O
of	O
each	O
bin	O
and	O
their	O
starting	O
index	O
.	O
</s>
<s>
4-bits	O
per	O
digit	O
in	O
the	O
case	O
of	O
16-radix	O
)	O
,	O
starting	O
from	O
the	O
most	O
significant	B-Architecture
digit	I-Architecture
.	O
</s>
<s>
Each	O
bin	O
is	O
then	O
processed	O
recursively	O
using	O
the	O
next	O
digit	O
,	O
until	O
all	O
digits	O
have	O
been	O
used	O
for	O
sorting	B-Algorithm
.	O
</s>
<s>
MSD	O
radix	B-Algorithm
sort	I-Algorithm
can	O
be	O
implemented	O
as	O
a	O
stable	O
algorithm	O
,	O
but	O
requires	O
the	O
use	O
of	O
a	O
memory	O
buffer	O
of	O
the	O
same	O
size	O
as	O
the	O
input	O
array	O
.	O
</s>
<s>
Each	O
of	O
the	O
bins	O
are	O
recursively	O
processed	O
,	O
as	O
is	O
done	O
for	O
the	O
in-place	O
MSD	O
radix	B-Algorithm
sort	I-Algorithm
.	O
</s>
<s>
After	O
the	O
sort	O
by	O
the	O
last	B-Architecture
digit	I-Architecture
has	O
been	O
completed	O
,	O
the	O
output	O
buffer	O
is	O
checked	O
to	O
see	O
if	O
it	O
is	O
the	O
original	O
input	O
array	O
,	O
and	O
if	O
it	O
's	O
not	O
,	O
then	O
a	O
single	O
copy	O
is	O
performed	O
.	O
</s>
<s>
Radix	B-Algorithm
sort	I-Algorithm
,	O
such	O
as	O
the	O
two-pass	O
method	O
where	O
counting	B-Algorithm
sort	I-Algorithm
is	O
used	O
during	O
the	O
first	O
pass	O
of	O
each	O
level	O
of	O
recursion	O
,	O
has	O
a	O
large	O
constant	O
overhead	O
.	O
</s>
<s>
Thus	O
,	O
when	O
the	O
bins	O
get	O
small	O
,	O
other	O
sorting	B-Algorithm
algorithms	I-Algorithm
should	O
be	O
used	O
,	O
such	O
as	O
insertion	B-Algorithm
sort	I-Algorithm
.	O
</s>
<s>
A	O
good	O
implementation	O
of	O
insertion	B-Algorithm
sort	I-Algorithm
is	O
fast	O
for	O
small	O
arrays	O
,	O
stable	O
,	O
in-place	O
,	O
and	O
can	O
significantly	O
speed	O
up	O
radix	B-Algorithm
sort	I-Algorithm
.	O
</s>
<s>
This	O
recursive	O
sorting	B-Algorithm
algorithm	I-Algorithm
has	O
particular	O
application	O
to	O
parallel	B-Operating_System
computing	I-Operating_System
,	O
as	O
each	O
of	O
the	O
bins	O
can	O
be	O
sorted	O
independently	O
.	O
</s>
<s>
A	O
single	O
processor	O
would	O
be	O
used	O
at	O
the	O
start	O
(	O
the	O
most	O
significant	B-Architecture
digit	I-Architecture
)	O
.	O
</s>
<s>
In	O
the	O
worst	O
case	O
,	O
all	O
of	O
the	O
keys	O
will	O
be	O
identical	O
or	O
nearly	O
identical	O
to	O
each	O
other	O
,	O
with	O
the	O
result	O
that	O
there	O
will	O
be	O
little	O
to	O
no	O
advantage	O
to	O
using	O
parallel	B-Operating_System
computing	I-Operating_System
to	O
sort	O
the	O
keys	O
.	O
</s>
<s>
In	O
the	O
top	O
level	O
of	O
recursion	O
,	O
opportunity	O
for	O
parallelism	B-Operating_System
is	O
in	O
the	O
counting	B-Algorithm
sort	I-Algorithm
portion	O
of	O
the	O
algorithm	O
.	O
</s>
<s>
This	O
portion	O
of	O
the	O
algorithm	O
has	O
data-independent	O
parallelism	B-Operating_System
.	O
</s>
<s>
For	O
example	O
,	O
if	O
all	O
keys	O
were	O
of	O
the	O
same	O
value	O
,	O
then	O
there	O
would	O
be	O
only	O
a	O
single	O
bin	O
with	O
any	O
elements	O
in	O
it	O
,	O
and	O
no	O
parallelism	B-Operating_System
would	O
be	O
available	O
.	O
</s>
<s>
For	O
random	O
inputs	O
all	O
bins	O
would	O
be	O
near	O
equally	O
populated	O
and	O
a	O
large	O
amount	O
of	O
parallelism	B-Operating_System
opportunity	O
would	O
be	O
available	O
.	O
</s>
<s>
There	O
are	O
faster	O
parallel	O
sorting	B-Algorithm
algorithms	I-Algorithm
available	O
,	O
for	O
example	O
optimal	O
complexity	O
O(log(n )	O
)	O
are	O
those	O
of	O
the	O
Three	O
Hungarians	O
and	O
Richard	O
Cole	O
and	O
Batcher	O
's	O
bitonic	B-Algorithm
merge	I-Algorithm
sort	I-Algorithm
has	O
an	O
algorithmic	O
complexity	O
of	O
O(log2(n )	O
)	O
,	O
all	O
of	O
which	O
have	O
a	O
lower	O
algorithmic	O
time	O
complexity	O
to	O
radix	B-Algorithm
sort	I-Algorithm
on	O
a	O
CREW-PRAM	B-Operating_System
.	O
</s>
<s>
The	O
fastest	O
known	O
PRAM	B-Operating_System
sorts	O
were	O
described	O
in	O
1991	O
by	O
David	O
Powers	O
with	O
a	O
parallelized	B-Operating_System
quicksort	B-Algorithm
that	O
can	O
operate	O
in	O
O(log(n )	O
)	O
time	O
on	O
a	O
CRCW-PRAM	B-Operating_System
with	O
n	O
processors	O
by	O
performing	O
partitioning	O
implicitly	O
,	O
as	O
well	O
as	O
a	O
radixsort	B-Algorithm
that	O
operates	O
using	O
the	O
same	O
trick	O
in	O
O(k )	O
,	O
where	O
k	O
is	O
the	O
maximum	O
keylength	O
.	O
</s>
<s>
However	O
,	O
neither	O
the	O
PRAM	B-Operating_System
architecture	O
or	O
a	O
single	O
sequential	O
processor	O
can	O
actually	O
be	O
built	O
in	O
a	O
way	O
that	O
will	O
scale	O
without	O
the	O
number	O
of	O
constant	O
fan-out	B-General_Concept
gate	O
delays	O
per	O
cycle	O
increasing	O
as	O
O(log(n )	O
)	O
,	O
so	O
that	O
in	O
effect	O
a	O
pipelined	O
version	O
of	O
Batcher	O
's	O
bitonic	B-Algorithm
mergesort	I-Algorithm
and	O
the	O
O(log(n )	O
)	O
PRAM	B-Operating_System
sorts	O
are	O
all	O
O(log2(n )	O
)	O
in	O
terms	O
of	O
clock	O
cycles	O
,	O
with	O
Powers	O
acknowledging	O
that	O
Batcher	O
's	O
would	O
have	O
lower	O
constant	O
in	O
terms	O
of	O
gate	O
delays	O
than	O
his	O
Parallel	B-Algorithm
quicksort	I-Algorithm
and	O
radix	B-Algorithm
sort	I-Algorithm
,	O
or	O
Cole	O
's	O
merge	B-Algorithm
sort	I-Algorithm
,	O
for	O
a	O
keylength-independent	O
sorting	B-Algorithm
network	I-Algorithm
of	O
O(nlog2(n )	O
)	O
.	O
</s>
<s>
Radix	B-Algorithm
sorting	I-Algorithm
can	O
also	O
be	O
accomplished	O
by	O
building	O
a	O
tree	B-Application
(	O
or	O
radix	B-Data_Structure
tree	I-Data_Structure
)	O
from	O
the	O
input	O
set	O
,	O
and	O
doing	O
a	O
pre-order	O
traversal	O
.	O
</s>
<s>
This	O
is	O
similar	O
to	O
the	O
relationship	O
between	O
heapsort	B-Application
and	O
the	O
heap	B-Application
data	I-Application
structure	I-Application
.	O
</s>
<s>
This	O
can	O
be	O
useful	O
for	O
certain	O
data	O
types	O
,	O
see	O
burstsort	B-Algorithm
.	O
</s>
