<s>
Spreadsort	B-Algorithm
is	O
a	O
sorting	B-Algorithm
algorithm	I-Algorithm
invented	O
by	O
Steven	O
J	O
.	O
Ross	O
in	O
2002	O
.	O
</s>
<s>
It	O
combines	O
concepts	O
from	O
distribution-based	O
sorts	O
,	O
such	O
as	O
radix	B-Algorithm
sort	I-Algorithm
and	O
bucket	B-Algorithm
sort	I-Algorithm
,	O
with	O
partitioning	O
concepts	O
from	O
comparison	O
sorts	O
such	O
as	O
quicksort	B-Algorithm
and	O
mergesort	B-Algorithm
.	O
</s>
<s>
In	O
experimental	O
results	O
it	O
was	O
shown	O
to	O
be	O
highly	O
efficient	O
,	O
often	O
outperforming	O
traditional	O
algorithms	O
such	O
as	O
quicksort	B-Algorithm
,	O
particularly	O
on	O
distributions	O
exhibiting	O
structure	O
and	O
string	O
sorting	B-Algorithm
.	O
</s>
<s>
Quicksort	B-Algorithm
identifies	O
a	O
pivot	O
element	O
in	O
the	O
list	O
and	O
then	O
partitions	O
the	O
list	O
into	O
two	O
sublists	O
,	O
those	O
elements	O
less	O
than	O
the	O
pivot	O
and	O
those	O
greater	O
than	O
the	O
pivot	O
.	O
</s>
<s>
Spreadsort	B-Algorithm
generalizes	O
this	O
idea	O
by	O
partitioning	O
the	O
list	O
into	O
n/c	O
partitions	O
at	O
each	O
step	O
,	O
where	O
n	O
is	O
the	O
total	O
number	O
of	O
elements	O
in	O
the	O
list	O
and	O
c	O
is	O
a	O
small	O
constant	O
(	O
in	O
practice	O
usually	O
between	O
4	O
and	O
8	O
when	O
comparisons	O
are	O
slow	O
,	O
or	O
much	O
larger	O
in	O
situations	O
where	O
they	O
are	O
fast	O
)	O
.	O
</s>
<s>
In	O
the	O
case	O
where	O
the	O
number	O
of	O
bins	O
is	O
at	O
least	O
the	O
number	O
of	O
elements	O
,	O
spreadsort	B-Algorithm
degenerates	O
to	O
bucket	B-Algorithm
sort	I-Algorithm
and	O
the	O
sort	O
completes	O
.	O
</s>
<s>
The	O
algorithm	O
uses	O
heuristic	O
tests	O
to	O
determine	O
whether	O
each	O
bin	O
would	O
be	O
more	O
efficiently	O
sorted	O
by	O
spreadsort	B-Algorithm
or	O
some	O
other	O
classical	O
sort	B-Algorithm
algorithm	I-Algorithm
,	O
then	O
recursively	O
sorts	O
the	O
bin	O
.	O
</s>
<s>
Like	O
other	O
distribution-based	O
sorts	O
,	O
spreadsort	B-Algorithm
has	O
the	O
weakness	O
that	O
the	O
programmer	O
is	O
required	O
to	O
provide	O
a	O
means	O
of	O
converting	O
each	O
element	O
into	O
a	O
numeric	O
key	O
,	O
for	O
the	O
purpose	O
of	O
identifying	O
which	O
bin	O
it	O
falls	O
in	O
.	O
</s>
<s>
The	O
worst-case	O
performance	O
of	O
spreadsort	B-Algorithm
is	O
O(n log n )	O
for	O
small	O
data	O
sets	O
,	O
as	O
it	O
uses	O
introsort	O
as	O
a	O
fallback	O
.	O
</s>
<s>
For	O
many	O
real	O
sorting	B-Algorithm
problems	I-Algorithm
with	O
over	O
1000	O
items	O
,	O
including	O
string	O
sorting	B-Algorithm
,	O
this	O
asymptotic	O
worst-case	O
is	O
better	O
than	O
O(n log n )	O
.	O
</s>
<s>
Experiments	O
were	O
done	O
comparing	O
an	O
optimized	O
version	O
of	O
spreadsort	B-Algorithm
to	O
the	O
highly	O
optimized	O
C++	O
std::sort	O
,	O
implemented	O
with	O
introsort	O
.	O
</s>
<s>
On	O
lists	O
of	O
integers	O
and	O
floats	O
spreadsort	B-Algorithm
shows	O
a	O
roughly	O
2	O
–	O
7×	O
runtime	O
improvement	O
for	O
random	O
data	O
on	O
various	O
operating	O
systems	O
.	O
</s>
<s>
In	O
space	O
performance	O
,	O
spreadsort	B-Algorithm
is	O
worse	O
than	O
most	O
in-place	O
algorithms	O
:	O
in	O
its	O
simplest	O
form	O
,	O
it	O
is	O
not	O
an	O
in-place	O
algorithm	O
,	O
using	O
O(n )	O
extra	O
space	O
;	O
in	O
experiments	O
,	O
about	O
20%	O
more	O
than	O
quicksort	B-Algorithm
using	O
a	O
c	O
of	O
4	O
–	O
8	O
.	O
</s>
<s>
Although	O
it	O
uses	O
asymptotically	O
more	O
space	O
than	O
the	O
O(log n )	O
overhead	O
of	O
quicksort	B-Algorithm
or	O
the	O
O(1 )	O
overhead	O
of	O
heapsort	O
,	O
it	O
uses	O
considerably	O
less	O
space	O
than	O
the	O
basic	O
form	O
of	O
mergesort	B-Algorithm
,	O
which	O
uses	O
auxiliary	O
space	O
equal	O
to	O
the	O
space	O
occupied	O
by	O
the	O
list	O
.	O
</s>
<s>
An	O
interesting	O
result	O
for	O
algorithms	O
of	O
this	O
general	O
type	O
(	O
splitting	O
based	O
on	O
the	O
radix	O
,	O
then	O
comparison-based	O
sorting	B-Algorithm
)	O
is	O
that	O
they	O
are	O
O(n )	O
for	O
any	O
bounded	O
and	O
integrable	O
probability	O
density	O
function	O
.	O
</s>
<s>
This	O
result	O
can	O
be	O
obtained	O
by	O
forcing	O
Spreadsort	B-Algorithm
to	O
always	O
iterate	O
one	O
more	O
time	O
if	O
the	O
bin	O
size	O
after	O
the	O
first	O
iteration	O
is	O
above	O
some	O
constant	O
value	O
.	O
</s>
<s>
If	O
the	O
key	O
density	O
function	O
is	O
known	O
to	O
be	O
Riemann	O
integrable	O
and	O
bounded	O
,	O
this	O
modification	O
of	O
Spreadsort	B-Algorithm
can	O
attain	O
some	O
performance	O
improvement	O
over	O
the	O
basic	O
algorithm	O
,	O
and	O
will	O
have	O
better	O
worst-case	O
performance	O
.	O
</s>
<s>
Other	O
similar	O
algorithms	O
are	O
Flashsort	B-Algorithm
(	O
which	O
is	O
simpler	O
)	O
and	O
Adaptive	O
Left	O
Radix	O
.	O
</s>
<s>
Adaptive	O
Left	O
Radix	O
is	O
apparently	O
quite	O
similar	O
,	O
the	O
main	O
difference	O
being	O
recursive	O
behavior	O
,	O
with	O
Spreadsort	B-Algorithm
checking	O
for	O
worst-case	O
situations	O
and	O
using	O
std::sort	O
to	O
avoid	O
performance	O
problems	O
where	O
necessary	O
,	O
and	O
Adaptive	O
Left	O
Radix	O
recursing	O
continuously	O
until	O
done	O
or	O
the	O
data	O
is	O
small	O
enough	O
to	O
use	O
insertion	O
sort	O
.	O
</s>
