<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
a	O
y-fast	B-Data_Structure
trie	I-Data_Structure
is	O
a	O
data	B-General_Concept
structure	I-General_Concept
for	O
storing	O
integers	O
from	O
a	O
bounded	O
domain	O
.	O
</s>
<s>
The	O
structure	O
was	O
proposed	O
by	O
Dan	O
Willard	O
in	O
1982	O
to	O
decrease	O
the	O
O(nlogM )	O
space	O
used	O
by	O
an	O
x-fast	B-Data_Structure
trie	I-Data_Structure
.	O
</s>
<s>
A	O
y-fast	B-Data_Structure
trie	I-Data_Structure
consists	O
of	O
two	O
data	B-General_Concept
structures	I-General_Concept
:	O
the	O
top	O
half	O
is	O
an	O
x-fast	B-Data_Structure
trie	I-Data_Structure
and	O
the	O
lower	O
half	O
consists	O
of	O
a	O
number	O
of	O
balanced	B-Data_Structure
binary	I-Data_Structure
trees	I-Data_Structure
.	O
</s>
<s>
The	O
keys	O
are	O
divided	O
into	O
groups	O
of	O
O(logM )	O
consecutive	O
elements	O
and	O
for	O
each	O
group	O
a	O
balanced	B-Data_Structure
binary	I-Data_Structure
search	I-Data_Structure
tree	I-Data_Structure
is	O
created	O
.	O
</s>
<s>
For	O
each	O
balanced	B-Data_Structure
binary	I-Data_Structure
search	I-Data_Structure
tree	I-Data_Structure
a	O
representative	O
r	O
is	O
chosen	O
.	O
</s>
<s>
These	O
representatives	O
are	O
stored	O
in	O
the	O
x-fast	B-Data_Structure
trie	I-Data_Structure
.	O
</s>
<s>
Since	O
the	O
x-fast	B-Data_Structure
trie	I-Data_Structure
stores	O
O( 	O
n/logM	O
)	O
representatives	O
and	O
each	O
representative	O
occurs	O
in	O
O(logM )	O
hash	O
tables	O
,	O
this	O
part	O
of	O
the	O
y-fast	B-Data_Structure
trie	I-Data_Structure
uses	O
O(n )	O
space	O
.	O
</s>
<s>
The	O
balanced	B-Data_Structure
binary	I-Data_Structure
search	I-Data_Structure
trees	I-Data_Structure
store	O
n	O
elements	O
in	O
total	O
which	O
uses	O
O(n )	O
space	O
.	O
</s>
<s>
Hence	O
,	O
in	O
total	O
a	O
y-fast	B-Data_Structure
trie	I-Data_Structure
uses	O
O(n )	O
space	O
.	O
</s>
<s>
Like	O
van	B-Application
Emde	I-Application
Boas	I-Application
trees	I-Application
and	O
x-fast	B-Data_Structure
tries	I-Data_Structure
,	O
y-fast	B-Data_Structure
tries	I-Data_Structure
support	O
the	O
operations	O
of	O
an	O
ordered	O
associative	B-Application
array	I-Application
.	O
</s>
<s>
This	O
includes	O
the	O
usual	O
associative	B-Application
array	I-Application
operations	O
,	O
along	O
with	O
two	O
more	O
order	O
operations	O
,	O
Successor	O
and	O
Predecessor	O
:	O
</s>
<s>
Hence	O
,	O
one	O
first	O
finds	O
the	O
smallest	O
representative	O
r	O
greater	O
than	O
k	O
in	O
the	O
x-fast	B-Data_Structure
trie	I-Data_Structure
.	O
</s>
<s>
Using	O
this	O
representative	O
,	O
one	O
retrieves	O
the	O
predecessor	O
of	O
r	O
.	O
These	O
two	O
representatives	O
point	O
to	O
two	O
balanced	B-Data_Structure
binary	I-Data_Structure
search	I-Data_Structure
trees	I-Data_Structure
,	O
both	O
of	O
which	O
one	O
searches	O
for	O
k	O
.	O
</s>
<s>
Finding	O
the	O
smallest	O
representative	O
r	O
greater	O
than	O
k	O
in	O
the	O
x-fast	B-Data_Structure
trie	I-Data_Structure
takes	O
O(loglogM )	O
.	O
</s>
<s>
Searching	O
the	O
two	O
balanced	B-Data_Structure
binary	I-Data_Structure
search	I-Data_Structure
trees	I-Data_Structure
containing	O
O(logM )	O
elements	O
each	O
takes	O
O(loglogM )	O
time	O
.	O
</s>
<s>
Similarly	O
to	O
the	O
key	O
k	O
itself	O
,	O
its	O
successor	O
can	O
be	O
stored	O
in	O
either	O
the	O
tree	O
of	O
the	O
smallest	O
representative	O
r	O
greater	O
than	O
k	O
or	O
in	O
the	O
tree	O
of	O
the	O
predecessor	O
of	O
r	O
.	O
Hence	O
,	O
to	O
find	O
the	O
successor	O
of	O
a	O
key	O
k	O
,	O
one	O
first	O
searches	O
the	O
x-fast	B-Data_Structure
trie	I-Data_Structure
for	O
the	O
smallest	O
representative	O
greater	O
than	O
k	O
.	O
Next	O
,	O
one	O
uses	O
this	O
representative	O
to	O
retrieve	O
its	O
predecessor	O
in	O
the	O
x-fast	B-Data_Structure
trie	I-Data_Structure
.	O
</s>
<s>
These	O
two	O
representatives	O
point	O
to	O
two	O
balanced	B-Data_Structure
binary	I-Data_Structure
search	I-Data_Structure
trees	I-Data_Structure
,	O
which	O
one	O
searches	O
for	O
the	O
successor	O
of	O
k	O
.	O
</s>
<s>
Finding	O
the	O
smallest	O
representative	O
r	O
greater	O
than	O
k	O
in	O
the	O
x-fast	B-Data_Structure
trie	I-Data_Structure
takes	O
O(loglogM )	O
time	O
and	O
using	O
r	O
to	O
find	O
its	O
predecessor	O
takes	O
constant	O
time	O
.	O
</s>
<s>
Searching	O
the	O
two	O
balanced	B-Data_Structure
binary	I-Data_Structure
search	I-Data_Structure
trees	I-Data_Structure
containing	O
O(logM )	O
elements	O
each	O
takes	O
O(loglogM )	O
time	O
.	O
</s>
<s>
One	O
searches	O
the	O
x-fast	B-Data_Structure
trie	I-Data_Structure
for	O
the	O
largest	O
representative	O
r	O
smaller	O
than	O
k	O
and	O
one	O
uses	O
r	O
to	O
retrieve	O
its	O
predecessor	O
in	O
the	O
x-fast	B-Data_Structure
trie	I-Data_Structure
.	O
</s>
<s>
Finally	O
,	O
one	O
searches	O
the	O
two	O
balanced	B-Data_Structure
binary	I-Data_Structure
search	I-Data_Structure
trees	I-Data_Structure
of	O
these	O
two	O
representatives	O
for	O
the	O
predecessor	O
of	O
k	O
.	O
This	O
takes	O
O(loglogM )	O
time	O
.	O
</s>
<s>
To	O
insert	O
a	O
new	O
key/value	O
pair	O
(	O
k	O
,	O
v	O
)	O
,	O
one	O
first	O
needs	O
to	O
determine	O
in	O
which	O
balanced	B-Data_Structure
binary	I-Data_Structure
search	I-Data_Structure
tree	I-Data_Structure
one	O
needs	O
to	O
insert	O
k	O
.	O
To	O
this	O
end	O
,	O
one	O
finds	O
the	O
tree	O
T	O
containing	O
the	O
successor	O
of	O
k	O
.	O
Next	O
,	O
one	O
inserts	O
k	O
into	O
T	O
.	O
To	O
ensure	O
that	O
all	O
balanced	B-Data_Structure
binary	I-Data_Structure
search	I-Data_Structure
trees	I-Data_Structure
contain	O
O(logM )	O
elements	O
,	O
one	O
splits	O
T	O
into	O
two	O
balanced	B-Data_Structure
binary	I-Data_Structure
trees	I-Data_Structure
and	O
removes	O
its	O
representative	O
from	O
the	O
x-fast	B-Data_Structure
trie	I-Data_Structure
if	O
it	O
contains	O
more	O
than	O
2logM	O
elements	O
.	O
</s>
<s>
Each	O
of	O
the	O
two	O
new	O
balanced	B-Data_Structure
binary	I-Data_Structure
search	I-Data_Structure
trees	I-Data_Structure
contains	O
at	O
most	O
logM+1	O
elements	O
.	O
</s>
<s>
One	O
picks	O
a	O
representative	O
for	O
each	O
tree	O
and	O
insert	O
these	O
into	O
the	O
x-fast	B-Data_Structure
trie	I-Data_Structure
.	O
</s>
<s>
Inserting	O
k	O
into	O
a	O
balanced	B-Data_Structure
binary	I-Data_Structure
search	I-Data_Structure
tree	I-Data_Structure
that	O
contains	O
O(logM )	O
elements	O
also	O
takes	O
O(loglogM )	O
time	O
.	O
</s>
<s>
However	O
,	O
since	O
one	O
splits	O
the	O
tree	O
at	O
most	O
once	O
every	O
O(logM )	O
insertions	O
and	O
deletions	O
,	O
this	O
takes	O
constant	O
amortized	B-General_Concept
time	I-General_Concept
.	O
</s>
<s>
Therefore	O
,	O
inserting	O
a	O
new	O
key/value	O
pair	O
takes	O
O(loglogM )	O
amortized	B-General_Concept
time	I-General_Concept
.	O
</s>
<s>
One	O
first	O
finds	O
the	O
key	O
k	O
in	O
one	O
of	O
the	O
balanced	B-Data_Structure
binary	I-Data_Structure
search	I-Data_Structure
trees	I-Data_Structure
and	O
delete	O
it	O
from	O
this	O
tree	O
T	O
.	O
To	O
ensure	O
that	O
all	O
balanced	B-Data_Structure
binary	I-Data_Structure
search	I-Data_Structure
trees	I-Data_Structure
contain	O
O(logM )	O
elements	O
,	O
one	O
merges	O
T	O
with	O
the	O
balanced	B-Data_Structure
binary	I-Data_Structure
search	I-Data_Structure
tree	I-Data_Structure
of	O
its	O
successor	O
or	O
predecessor	O
if	O
it	O
contains	O
less	O
than	O
(	O
logM	O
)	O
/4	O
elements	O
.	O
</s>
<s>
The	O
representatives	O
of	O
the	O
merged	O
trees	O
are	O
removed	O
from	O
the	O
x-fast	B-Data_Structure
trie	I-Data_Structure
.	O
</s>
<s>
Next	O
,	O
one	O
picks	O
a	O
new	O
representative	O
for	O
each	O
of	O
the	O
new	O
trees	O
and	O
one	O
inserts	O
these	O
into	O
the	O
x-fast	B-Data_Structure
trie	I-Data_Structure
.	O
</s>
<s>
Deleting	O
k	O
from	O
a	O
balanced	B-Data_Structure
binary	I-Data_Structure
search	I-Data_Structure
tree	I-Data_Structure
that	O
contains	O
O(logM )	O
elements	O
also	O
takes	O
O(loglogM )	O
time	O
.	O
</s>
<s>
Merging	O
and	O
possibly	O
splitting	O
the	O
balanced	B-Data_Structure
binary	I-Data_Structure
search	I-Data_Structure
trees	I-Data_Structure
takes	O
O(loglogM )	O
time	O
.	O
</s>
<s>
Finally	O
,	O
deleting	O
the	O
old	O
representatives	O
and	O
inserting	O
the	O
new	O
representatives	O
into	O
the	O
x-fast	B-Data_Structure
trie	I-Data_Structure
takes	O
O(logM )	O
time	O
.	O
</s>
<s>
Merging	O
and	O
possibly	O
splitting	O
the	O
balanced	B-Data_Structure
binary	I-Data_Structure
search	I-Data_Structure
tree	I-Data_Structure
,	O
however	O
,	O
is	O
done	O
at	O
most	O
once	O
for	O
every	O
O(logM )	O
insertions	O
and	O
deletions	O
.	O
</s>
<s>
Hence	O
,	O
it	O
takes	O
constant	O
amortized	B-General_Concept
time	I-General_Concept
.	O
</s>
<s>
Therefore	O
,	O
deleting	O
a	O
key/value	O
pair	O
takes	O
O(loglogM )	O
amortized	B-General_Concept
time	I-General_Concept
.	O
</s>
