<s>
Funnelsort	B-Algorithm
is	O
a	O
comparison-based	B-Algorithm
sorting	B-Algorithm
algorithm	I-Algorithm
.	O
</s>
<s>
It	O
is	O
similar	O
to	O
mergesort	B-Algorithm
,	O
but	O
it	O
is	O
a	O
cache-oblivious	B-Application
algorithm	I-Application
,	O
designed	O
for	O
a	O
setting	O
where	O
the	O
number	O
of	O
elements	O
to	O
sort	O
is	O
too	O
large	O
to	O
fit	O
in	O
a	O
cache	B-General_Concept
where	O
operations	O
are	O
done	O
.	O
</s>
<s>
It	O
was	O
introduced	O
by	O
Matteo	O
Frigo	O
,	O
Charles	O
Leiserson	O
,	O
Harald	O
Prokop	O
,	O
and	O
Sridhar	O
Ramachandran	O
in	O
1999	O
in	O
the	O
context	O
of	O
the	O
cache	B-Application
oblivious	I-Application
model	I-Application
.	O
</s>
<s>
In	O
the	O
external	B-Application
memory	I-Application
model	I-Application
,	O
the	O
number	O
of	O
memory	O
transfers	O
it	O
needs	O
to	O
perform	O
a	O
sort	O
of	O
items	O
on	O
a	O
machine	O
with	O
cache	B-General_Concept
of	O
size	O
and	O
cache	B-General_Concept
lines	O
of	O
length	O
is	O
,	O
under	O
the	O
tall	O
cache	B-General_Concept
assumption	O
that	O
.	O
</s>
<s>
This	O
number	O
of	O
memory	O
transfers	O
has	O
been	O
shown	O
to	O
be	O
asymptotically	B-General_Concept
optimal	I-General_Concept
for	O
comparison	B-Algorithm
sorts	I-Algorithm
.	O
</s>
<s>
Funnelsort	B-Algorithm
also	O
achieves	O
the	O
asymptotically	B-General_Concept
optimal	I-General_Concept
runtime	O
complexity	O
of	O
.	O
</s>
<s>
Funnelsort	B-Algorithm
operates	O
on	O
a	O
contiguous	O
array	O
of	O
elements	O
.	O
</s>
<s>
Funnelsort	B-Algorithm
is	O
similar	O
to	O
merge	B-Algorithm
sort	I-Algorithm
in	O
that	O
some	O
number	O
of	O
subarrays	O
are	O
recursively	O
sorted	O
,	O
after	O
which	O
a	O
merging	O
step	O
combines	O
the	O
subarrays	O
into	O
one	O
sorted	O
array	O
.	O
</s>
<s>
At	O
the	O
top	O
level	O
,	O
funnelsort	B-Algorithm
uses	O
a	O
-merger	O
on	O
sequences	O
of	O
length	O
,	O
and	O
invokes	O
this	O
merger	O
once	O
.	O
</s>
<s>
The	O
output	O
of	O
each	O
input	O
merger	O
is	O
connected	O
to	O
a	O
buffer	O
,	O
a	O
FIFO	B-Operating_System
queue	B-Application
that	O
can	O
hold	O
elements	O
.	O
</s>
<s>
The	O
buffers	O
are	O
implemented	O
as	O
circular	B-Data_Structure
queues	I-Data_Structure
.	O
</s>
<s>
Most	O
of	O
the	O
analysis	O
of	O
this	O
algorithm	O
revolves	O
around	O
analyzing	O
the	O
space	O
and	O
cache	B-General_Concept
miss	O
complexity	O
of	O
the	O
k-merger	O
.	O
</s>
<s>
It	O
follows	O
that	O
there	O
is	O
a	O
positive	O
constant	O
such	O
that	O
a	O
problem	O
of	O
size	O
at	O
most	O
fits	O
entirely	O
in	O
cache	B-General_Concept
,	O
meaning	O
that	O
it	O
incurs	O
no	O
additional	O
cache	B-General_Concept
misses	O
.	O
</s>
<s>
Letting	O
denote	O
the	O
number	O
of	O
cache	B-General_Concept
misses	O
incurred	O
by	O
a	O
call	O
to	O
a	O
k-merger	O
,	O
one	O
can	O
show	O
that	O
This	O
is	O
done	O
by	O
an	O
induction	O
argument	O
.	O
</s>
<s>
This	O
is	O
done	O
on	O
buffers	O
every	O
step	O
for	O
steps	O
,	O
leading	O
to	O
a	O
max	O
of	O
cache	B-General_Concept
misses	O
for	O
all	O
the	O
checks	O
.	O
</s>
<s>
Finally	O
,	O
the	O
total	O
cache	B-General_Concept
misses	O
for	O
the	O
entire	O
sort	O
can	O
be	O
analyzed	O
.	O
</s>
<s>
Lazy	O
funnelsort	B-Algorithm
is	O
a	O
modification	O
of	O
the	O
funnelsort	B-Algorithm
,	O
introduced	O
by	O
Gerth	O
Stølting	O
Brodal	O
and	O
Rolf	O
Fagerberg	O
in	O
2002	O
.	O
</s>
<s>
This	O
modification	O
has	O
the	O
same	O
asymptotic	O
runtime	O
and	O
memory	O
transfers	O
as	O
the	O
original	O
funnelsort	B-Algorithm
,	O
but	O
has	O
applications	O
in	O
cache-oblivious	B-Application
algorithms	I-Application
for	O
problems	O
in	O
computational	O
geometry	O
in	O
a	O
method	O
known	O
as	O
distribution	O
sweeping	O
.	O
</s>
