<s>
A	O
van	B-Application
Emde	I-Application
Boas	I-Application
tree	I-Application
(	O
)	O
,	O
also	O
known	O
as	O
a	O
vEB	B-Application
tree	I-Application
or	O
van	B-Application
Emde	I-Application
Boas	I-Application
priority	I-Application
queue	I-Application
,	O
is	O
a	O
tree	B-Application
data	I-Application
structure	I-Application
which	O
implements	O
an	O
associative	B-Application
array	I-Application
with	O
-bit	O
integer	O
keys	O
.	O
</s>
<s>
It	O
performs	O
all	O
operations	O
in	O
time	O
(	O
assuming	O
that	O
an	O
bit	O
operation	O
can	O
be	O
performed	O
in	O
constant	O
time	O
)	O
,	O
or	O
equivalently	O
in	O
time	O
,	O
where	O
is	O
the	O
largest	O
element	O
that	O
can	O
be	O
stored	O
in	O
the	O
tree	B-Application
.	O
</s>
<s>
The	O
parameter	O
is	O
not	O
to	O
be	O
confused	O
with	O
the	O
actual	O
number	O
of	O
elements	O
stored	O
in	O
the	O
tree	B-Application
,	O
by	O
which	O
the	O
performance	O
of	O
other	O
tree	B-Application
data-structures	O
is	O
often	O
measured	O
.	O
</s>
<s>
The	O
vEB	B-Application
tree	I-Application
has	O
poor	O
space	O
efficiency	O
.	O
</s>
<s>
A	O
vEB	O
supports	O
the	O
operations	O
of	O
an	O
ordered	O
associative	B-Application
array	I-Application
,	O
which	O
includes	O
the	O
usual	O
associative	B-Application
array	I-Application
operations	O
along	O
with	O
two	O
more	O
order	O
operations	O
,	O
FindNext	O
and	O
FindPrevious	O
:	O
</s>
<s>
A	O
vEB	B-Application
tree	I-Application
also	O
supports	O
the	O
operations	O
Minimum	O
and	O
Maximum	O
,	O
which	O
return	O
the	O
minimum	O
and	O
maximum	O
element	O
stored	O
in	O
the	O
tree	B-Application
respectively	O
.	O
</s>
<s>
These	O
both	O
run	O
in	O
time	O
,	O
since	O
the	O
minimum	O
and	O
maximum	O
element	O
are	O
stored	O
as	O
attributes	O
in	O
each	O
tree	B-Application
.	O
</s>
<s>
A	O
vEB	B-Application
tree	I-Application
over	O
the	O
universe	O
}	O
has	O
a	O
root	B-Application
node	I-Application
that	O
stores	O
an	O
array	O
of	O
length	O
.	O
</s>
<s>
is	O
a	O
pointer	O
to	O
a	O
vEB	B-Application
tree	I-Application
that	O
is	O
responsible	O
for	O
the	O
values	O
}	O
.	O
</s>
<s>
Additionally	O
,	O
T	O
stores	O
two	O
values	O
and	O
as	O
well	O
as	O
an	O
auxiliary	O
vEB	B-Application
tree	I-Application
.	O
</s>
<s>
Data	O
is	O
stored	O
in	O
a	O
vEB	B-Application
tree	I-Application
as	O
follows	O
:	O
The	O
smallest	O
value	O
currently	O
in	O
the	O
tree	B-Application
is	O
stored	O
in	O
and	O
largest	O
value	O
is	O
stored	O
in	O
.	O
</s>
<s>
Note	O
that	O
is	O
not	O
stored	O
anywhere	O
else	O
in	O
the	O
vEB	B-Application
tree	I-Application
,	O
while	O
is	O
.	O
</s>
<s>
Any	O
other	O
value	O
x	O
is	O
stored	O
in	O
the	O
subtree	B-Application
where	O
.	O
</s>
<s>
The	O
auxiliary	O
tree	B-Application
keeps	O
track	O
of	O
which	O
children	O
are	O
non-empty	O
,	O
so	O
contains	O
the	O
value	O
j	O
if	O
and	O
only	O
if	O
is	O
non-empty	O
.	O
</s>
<s>
The	O
operation	O
that	O
searches	O
for	O
the	O
successor	O
of	O
an	O
element	O
x	O
in	O
a	O
vEB	B-Application
tree	I-Application
proceeds	O
as	O
follows	O
:	O
If	O
then	O
the	O
search	O
is	O
complete	O
,	O
and	O
the	O
answer	O
is	O
.	O
</s>
<s>
This	O
gives	O
us	O
the	O
index	O
j	O
of	O
the	O
first	O
subtree	B-Application
that	O
contains	O
an	O
element	O
larger	O
than	O
x	O
.	O
</s>
<s>
Note	O
that	O
,	O
in	O
any	O
case	O
,	O
the	O
algorithm	O
performs	O
work	O
and	O
then	O
possibly	O
recurses	O
on	O
a	O
subtree	B-Application
over	O
a	O
universe	O
of	O
size	O
(	O
an	O
bit	O
universe	O
)	O
.	O
</s>
<s>
The	O
call	O
that	O
inserts	O
a	O
value	O
into	O
a	O
vEB	B-Application
tree	I-Application
operates	O
as	O
follows	O
:	O
</s>
<s>
Otherwise	O
,	O
if	O
then	O
we	O
insert	O
into	O
the	O
subtree	B-Application
responsible	O
for	O
and	O
then	O
set	O
.	O
</s>
<s>
Otherwise	O
,	O
if	O
then	O
we	O
insert	O
into	O
the	O
subtree	B-Application
responsible	O
for	O
and	O
then	O
set	O
.	O
</s>
<s>
Otherwise	O
,	O
so	O
we	O
insert	O
into	O
the	O
subtree	B-Application
responsible	O
for	O
.	O
</s>
<s>
The	O
key	O
to	O
the	O
efficiency	O
of	O
this	O
procedure	O
is	O
that	O
inserting	O
an	O
element	O
into	O
an	O
empty	O
vEB	B-Application
tree	I-Application
takes	O
time	O
.	O
</s>
<s>
So	O
,	O
even	O
though	O
the	O
algorithm	O
sometimes	O
makes	O
two	O
recursive	O
calls	O
,	O
this	O
only	O
occurs	O
when	O
the	O
first	O
recursive	O
call	O
was	O
into	O
an	O
empty	O
subtree	B-Application
.	O
</s>
<s>
Deletion	O
from	O
vEB	B-Application
trees	I-Application
is	O
the	O
trickiest	O
of	O
the	O
operations	O
.	O
</s>
<s>
The	O
call	O
that	O
deletes	O
a	O
value	O
x	O
from	O
a	O
vEB	B-Application
tree	I-Application
T	O
operates	O
as	O
follows	O
:	O
</s>
<s>
If	O
then	O
x	O
is	O
the	O
only	O
element	O
stored	O
in	O
the	O
tree	B-Application
and	O
we	O
set	O
and	O
to	O
indicate	O
that	O
the	O
tree	B-Application
is	O
empty	O
.	O
</s>
<s>
Otherwise	O
,	O
if	O
then	O
we	O
need	O
to	O
find	O
the	O
second-smallest	O
value	O
y	O
in	O
the	O
vEB	B-Application
tree	I-Application
,	O
delete	O
it	O
from	O
its	O
current	O
location	O
,	O
and	O
set	O
.	O
</s>
<s>
We	O
delete	O
y	O
from	O
the	O
subtree	B-Application
that	O
contains	O
it	O
.	O
</s>
<s>
If	O
and	O
then	O
we	O
delete	O
x	O
from	O
the	O
subtree	B-Application
that	O
contains	O
x	O
.	O
</s>
<s>
If	O
then	O
we	O
will	O
need	O
to	O
find	O
the	O
second-largest	O
value	O
y	O
in	O
the	O
vEB	B-Application
tree	I-Application
and	O
set	O
.	O
</s>
<s>
In	O
any	O
of	O
the	O
above	O
cases	O
,	O
if	O
we	O
delete	O
the	O
last	O
element	O
x	O
or	O
y	O
from	O
any	O
subtree	B-Application
then	O
we	O
also	O
delete	O
i	O
from	O
.	O
</s>
<s>
Again	O
,	O
the	O
efficiency	O
of	O
this	O
procedure	O
hinges	O
on	O
the	O
fact	O
that	O
deleting	O
from	O
a	O
vEB	B-Application
tree	I-Application
that	O
contains	O
only	O
one	O
element	O
takes	O
only	O
constant	O
time	O
.	O
</s>
<s>
In	O
practical	O
implementations	O
,	O
especially	O
on	O
machines	O
with	O
shift-by-k	O
and	O
find	O
first	O
zero	O
instructions	O
,	O
performance	O
can	O
further	O
be	O
improved	O
by	O
switching	O
to	O
a	O
bit	B-Data_Structure
array	I-Data_Structure
once	O
equal	O
to	O
the	O
word	O
size	O
(	O
or	O
a	O
small	O
multiple	O
thereof	O
)	O
is	O
reached	O
.	O
</s>
<s>
An	O
obvious	O
optimization	O
of	O
vEB	B-Application
trees	I-Application
is	O
to	O
discard	O
empty	O
subtrees	B-Application
.	O
</s>
<s>
This	O
makes	O
vEB	B-Application
trees	I-Application
quite	O
compact	O
when	O
they	O
contain	O
many	O
elements	O
,	O
because	O
no	O
subtrees	B-Application
are	O
created	O
until	O
something	O
needs	O
to	O
be	O
added	O
to	O
them	O
.	O
</s>
<s>
As	O
the	O
tree	B-Application
grows	O
,	O
more	O
and	O
more	O
subtrees	B-Application
are	O
reused	O
,	O
especially	O
the	O
larger	O
ones	O
.	O
</s>
<s>
In	O
a	O
full	O
tree	B-Application
of	O
elements	O
,	O
only	O
space	O
is	O
used	O
.	O
</s>
<s>
Moreover	O
,	O
unlike	O
a	O
binary	O
search	O
tree	B-Application
,	O
most	O
of	O
this	O
space	O
is	O
being	O
used	O
to	O
store	O
data	O
:	O
even	O
for	O
billions	O
of	O
elements	O
,	O
the	O
pointers	O
in	O
a	O
full	O
vEB	B-Application
tree	I-Application
number	O
in	O
the	O
thousands	O
.	O
</s>
<s>
The	O
space	O
usage	O
of	O
vEB	B-Application
trees	I-Application
is	O
an	O
enormous	O
overhead	O
unless	O
a	O
large	O
fraction	O
of	O
the	O
universe	O
of	O
keys	O
is	O
being	O
stored	O
.	O
</s>
<s>
This	O
is	O
one	O
reason	O
why	O
vEB	B-Application
trees	I-Application
are	O
not	O
popular	O
in	O
practice	O
.	O
</s>
<s>
One	O
possibility	O
is	O
to	O
use	O
only	O
a	O
fixed	O
number	O
of	O
bits	O
per	O
level	O
,	O
which	O
results	O
in	O
a	O
trie	B-General_Concept
.	O
</s>
<s>
Alternatively	O
,	O
each	O
array	O
may	O
be	O
replaced	O
by	O
a	O
hash	B-Algorithm
table	I-Algorithm
,	O
reducing	O
the	O
space	O
to	O
(	O
where	O
is	O
the	O
number	O
of	O
elements	O
stored	O
in	O
the	O
data	O
structure	O
)	O
at	O
the	O
expense	O
of	O
making	O
the	O
data	O
structure	O
randomized	O
.	O
</s>
<s>
x-fast	B-Data_Structure
tries	I-Data_Structure
and	O
the	O
more	O
complicated	O
y-fast	B-Data_Structure
tries	I-Data_Structure
have	O
comparable	O
update	O
and	O
query	O
times	O
to	O
vEB	B-Application
trees	I-Application
and	O
use	O
randomized	O
hash	B-Algorithm
tables	I-Algorithm
to	O
reduce	O
the	O
space	O
used	O
.	O
</s>
<s>
x-fast	B-Data_Structure
tries	I-Data_Structure
use	O
space	O
while	O
y-fast	B-Data_Structure
tries	I-Data_Structure
use	O
space	O
.	O
</s>
<s>
There	O
is	O
a	O
verified	O
implementation	O
in	O
Isabelle	B-Application
(	O
proof	O
assistant	O
)	O
.	O
</s>
<s>
Efficient	O
imperative	O
Standard	B-Language
ML	I-Language
code	O
can	O
be	O
generated	O
.	O
</s>
