<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
a	O
soft	B-Application
heap	I-Application
is	O
a	O
variant	O
on	O
the	O
simple	O
heap	B-Application
data	I-Application
structure	I-Application
that	O
has	O
constant	O
amortized	B-General_Concept
time	I-General_Concept
complexity	O
for	O
5	O
types	O
of	O
operations	O
.	O
</s>
<s>
This	O
is	O
achieved	O
by	O
carefully	O
"	O
corrupting	O
"	O
(	O
increasing	O
)	O
the	O
keys	O
of	O
at	O
most	O
a	O
constant	O
number	O
of	O
values	O
in	O
the	O
heap	B-Application
.	O
</s>
<s>
Other	O
heaps	B-Application
such	O
as	O
Fibonacci	B-Application
heaps	I-Application
achieve	O
most	O
of	O
these	O
bounds	O
without	O
any	O
corruption	O
,	O
but	O
cannot	O
provide	O
a	O
constant-time	O
bound	O
on	O
the	O
critical	O
delete	O
operation	O
.	O
</s>
<s>
More	O
precisely	O
,	O
the	O
guarantee	O
offered	O
by	O
the	O
soft	B-Application
heap	I-Application
is	O
the	O
following	O
:	O
for	O
a	O
fixed	O
value	O
ε	O
between	O
0	O
and	O
1/2	O
,	O
at	O
any	O
point	O
in	O
time	O
there	O
will	O
be	O
at	O
most	O
ε*n	O
corrupted	O
keys	O
in	O
the	O
heap	B-Application
,	O
where	O
n	O
is	O
the	O
number	O
of	O
elements	O
inserted	O
so	O
far	O
.	O
</s>
<s>
Note	O
that	O
this	O
does	O
not	O
guarantee	O
that	O
only	O
a	O
fixed	O
percentage	O
of	O
the	O
keys	O
currently	O
in	O
the	O
heap	B-Application
are	O
corrupted	O
:	O
in	O
an	O
unlucky	O
sequence	O
of	O
insertions	O
and	O
deletions	O
,	O
it	O
can	O
happen	O
that	O
all	O
elements	O
in	O
the	O
heap	B-Application
will	O
have	O
corrupted	O
keys	O
.	O
</s>
<s>
Similarly	O
,	O
we	O
have	O
no	O
guarantee	O
that	O
in	O
a	O
sequence	O
of	O
elements	O
extracted	O
from	O
the	O
heap	B-Application
with	O
findmin	O
and	O
delete	O
,	O
only	O
a	O
fixed	O
percentage	O
will	O
have	O
corrupted	O
keys	O
:	O
in	O
an	O
unlucky	O
scenario	O
only	O
corrupted	O
elements	O
are	O
extracted	O
from	O
the	O
heap	B-Application
.	O
</s>
<s>
The	O
soft	B-Application
heap	I-Application
was	O
designed	O
by	O
Bernard	O
Chazelle	O
in	O
2000	O
.	O
</s>
<s>
The	O
term	O
"	O
corruption	O
"	O
in	O
the	O
structure	O
is	O
the	O
result	O
of	O
what	O
Chazelle	O
called	O
"	O
carpooling	O
"	O
in	O
a	O
soft	B-Application
heap	I-Application
.	O
</s>
<s>
Each	O
node	O
in	O
the	O
soft	B-Application
heap	I-Application
contains	O
a	O
linked-list	O
of	O
keys	O
and	O
one	O
common	O
key	O
.	O
</s>
<s>
Once	O
a	O
key	O
is	O
added	O
to	O
the	O
linked-list	O
,	O
it	O
is	O
considered	O
corrupted	O
because	O
its	O
value	O
is	O
never	O
again	O
relevant	O
in	O
any	O
of	O
the	O
soft	B-Application
heap	I-Application
operations	O
:	O
only	O
the	O
common	O
keys	O
are	O
compared	O
.	O
</s>
<s>
This	O
is	O
what	O
makes	O
soft	B-Application
heaps	I-Application
"	O
soft	O
"	O
;	O
you	O
ca	O
n't	O
be	O
sure	O
whether	O
or	O
not	O
any	O
particular	O
value	O
you	O
put	O
into	O
it	O
will	O
be	O
corrupted	O
.	O
</s>
<s>
The	O
purpose	O
of	O
these	O
corruptions	O
is	O
effectively	O
to	O
lower	O
the	O
information	O
entropy	O
of	O
the	O
data	O
,	O
enabling	O
the	O
data	O
structure	O
to	O
break	O
through	O
information-theoretic	O
barriers	O
regarding	O
heaps	B-Application
.	O
</s>
<s>
Despite	O
their	O
limitations	O
and	O
unpredictable	O
nature	O
,	O
soft	B-Application
heaps	I-Application
are	O
useful	O
in	O
the	O
design	O
of	O
deterministic	O
algorithms	O
.	O
</s>
<s>
They	O
can	O
also	O
be	O
used	O
to	O
easily	O
build	O
an	O
optimal	O
selection	B-Algorithm
algorithm	I-Algorithm
,	O
as	O
well	O
as	O
near-sorting	O
algorithms	O
,	O
which	O
are	O
algorithms	O
that	O
place	O
every	O
element	O
near	O
its	O
final	O
position	O
,	O
a	O
situation	O
in	O
which	O
insertion	B-Algorithm
sort	I-Algorithm
is	O
fast	O
.	O
</s>
<s>
One	O
of	O
the	O
simplest	O
examples	O
is	O
the	O
selection	B-Algorithm
algorithm	I-Algorithm
.	O
</s>
<s>
Now	O
,	O
we	O
insert	O
all	O
n	O
elements	O
into	O
the	O
heap	B-Application
we	O
call	O
the	O
original	O
values	O
the	O
"	O
correct	O
"	O
keys	O
,	O
and	O
the	O
values	O
stored	O
in	O
the	O
heap	B-Application
the	O
"	O
stored	O
"	O
keys	O
.	O
</s>
<s>
Next	O
,	O
we	O
delete	O
the	O
minimum	O
element	O
from	O
the	O
heap	B-Application
n/3	O
times	O
(	O
this	O
is	O
done	O
according	O
to	O
the	O
"	O
stored	O
"	O
key	O
)	O
.	O
</s>
<s>
As	O
the	O
total	O
number	O
of	O
insertions	O
we	O
have	O
made	O
so	O
far	O
is	O
still	O
n	O
,	O
there	O
are	O
still	O
at	O
most	O
n/3	O
corrupted	O
keys	O
in	O
the	O
heap	B-Application
.	O
</s>
<s>
Accordingly	O
,	O
at	O
least	O
2n/3	O
n/3	O
=	O
n/3	O
of	O
the	O
keys	O
remaining	O
in	O
the	O
heap	B-Application
are	O
not	O
corrupted	O
.	O
</s>
<s>
The	O
stored	O
key	O
of	O
L	O
is	O
possibly	O
larger	O
than	O
its	O
correct	O
key	O
(	O
if	O
L	O
was	O
corrupted	O
)	O
,	O
and	O
even	O
this	O
larger	O
value	O
is	O
smaller	O
than	O
all	O
the	O
stored	O
keys	O
of	O
the	O
remaining	O
elements	O
in	O
the	O
heap	B-Application
(	O
as	O
we	O
were	O
removing	O
minimums	O
)	O
.	O
</s>
<s>
Therefore	O
,	O
the	O
correct	O
key	O
of	O
L	O
is	O
smaller	O
than	O
the	O
remaining	O
n/3	O
uncorrupted	O
elements	O
in	O
the	O
soft	B-Application
heap	I-Application
.	O
</s>
<s>
We	O
then	O
partition	O
the	O
set	O
about	O
L	O
using	O
the	O
partition	O
algorithm	O
from	O
quicksort	B-Algorithm
and	O
apply	O
the	O
same	O
algorithm	O
again	O
to	O
either	O
the	O
set	O
of	O
numbers	O
less	O
than	O
L	O
or	O
the	O
set	O
of	O
numbers	O
greater	O
than	O
L	O
,	O
neither	O
of	O
which	O
can	O
exceed	O
2n/3	O
elements	O
.	O
</s>
<s>
Since	O
each	O
insertion	O
and	O
deletion	O
requires	O
O(1 )	O
amortized	B-General_Concept
time	I-General_Concept
,	O
the	O
total	O
deterministic	O
time	O
is	O
T(n )	O
=	O
T( 	O
2n/3	O
)	O
+	O
O(n )	O
.	O
</s>
<s>
Using	O
case	O
3	O
of	O
the	O
master	B-Algorithm
theorem	I-Algorithm
for	I-Algorithm
divide-and-conquer	I-Algorithm
recurrences	I-Algorithm
(	O
with	O
ε	O
=	O
1	O
and	O
c	O
=	O
2/3	O
)	O
,	O
we	O
know	O
that	O
T(n )	O
=	O
Θ(n )	O
.	O
</s>
