<s>
The	O
HAT-trie	B-Data_Structure
is	O
a	O
type	O
of	O
radix	B-Data_Structure
trie	I-Data_Structure
that	O
uses	O
array	O
nodes	O
to	O
collect	O
individual	O
key	B-Application
–	I-Application
value	I-Application
pairs	I-Application
under	O
radix	O
nodes	O
and	O
hash	B-Error_Name
buckets	O
into	O
an	O
associative	B-Application
array	I-Application
.	O
</s>
<s>
Unlike	O
a	O
simple	O
hash	B-Algorithm
table	I-Algorithm
,	O
HAT-tries	B-Data_Structure
store	O
key	B-Application
–	I-Application
value	I-Application
in	O
an	O
ordered	O
collection	O
.	O
</s>
<s>
Askitis	O
&	O
Zobel	O
showed	O
that	O
building	O
and	O
accessing	O
the	O
HAT-trie	B-Data_Structure
key/value	B-Application
collection	O
is	O
considerably	O
faster	O
than	O
other	O
sorted	O
access	O
methods	O
and	O
is	O
comparable	O
to	O
the	O
array	O
hash	B-Error_Name
which	O
is	O
an	O
unsorted	O
collection	O
.	O
</s>
<s>
This	O
is	O
due	O
to	O
the	O
cache-friendly	O
nature	O
of	O
the	O
data	O
structure	O
which	O
attempts	O
to	O
group	O
access	O
to	O
data	O
in	O
time	O
and	O
space	O
into	O
the	O
64	O
byte	O
cache	B-General_Concept
line	I-General_Concept
size	I-General_Concept
of	O
the	O
modern	O
CPU	O
.	O
</s>
<s>
A	O
new	O
HAT-trie	B-Data_Structure
starts	O
out	O
as	O
a	O
NULL	O
pointer	O
representing	O
an	O
empty	O
node	O
.	O
</s>
<s>
The	O
first	O
added	O
key	O
allocates	O
the	O
smallest	O
array	O
node	O
and	O
copies	O
into	O
it	O
the	O
key/value	B-Application
pair	I-Application
,	O
which	O
becomes	O
the	O
first	O
root	O
of	O
the	O
trie	O
.	O
</s>
<s>
Each	O
subsequent	O
key/value	B-Application
pair	I-Application
is	O
added	O
to	O
the	O
initial	O
array	O
node	O
until	O
a	O
maximum	O
size	O
is	O
reached	O
after	O
which	O
the	O
node	O
is	O
burst	O
by	O
re-distributing	O
its	O
keys	O
into	O
a	O
hash	B-Error_Name
bucket	O
with	O
new	O
underlying	O
array	O
nodes	O
,	O
one	O
for	O
each	O
occupied	O
hash	B-Error_Name
slot	O
in	O
the	O
bucket	O
.	O
</s>
<s>
The	O
hash	B-Error_Name
bucket	O
becomes	O
the	O
new	O
root	O
of	O
the	O
trie	O
.	O
</s>
<s>
The	O
key	O
strings	O
are	O
stored	O
in	O
the	O
array	O
nodes	O
with	O
a	O
length	O
encoding	O
byte	O
prefixed	O
to	O
the	O
key	B-Application
value	I-Application
bytes	O
.	O
</s>
<s>
Once	O
the	O
trie	O
has	O
grown	O
into	O
its	O
first	O
hash	B-Error_Name
bucket	O
node	O
,	O
the	O
hash	B-Error_Name
bucket	O
distributes	O
new	O
keys	O
according	O
to	O
a	O
hash	B-Error_Name
function	I-Error_Name
of	O
the	O
key	B-Application
value	I-Application
into	O
array	O
nodes	O
contained	O
underneath	O
the	O
bucket	O
node	O
.	O
</s>
<s>
Keys	O
continue	O
to	O
be	O
added	O
until	O
a	O
maximum	O
number	O
of	O
keys	O
for	O
a	O
particular	O
hash	B-Error_Name
bucket	O
node	O
is	O
reached	O
.	O
</s>
<s>
The	O
bucket	O
contents	O
are	O
then	O
re-distributed	O
into	O
a	O
new	O
radix	O
node	O
according	O
to	O
the	O
stored	O
key	B-Application
value	I-Application
's	O
first	O
character	O
,	O
which	O
replaces	O
the	O
hash	B-Error_Name
bucket	O
node	O
as	O
the	O
trie	O
root	O
(	O
e.g.	O
</s>
<s>
see	O
Burstsort	B-Algorithm
)	O
.	O
</s>
<s>
The	O
existing	O
keys	O
and	O
values	O
contained	O
in	O
the	O
hash	B-Error_Name
bucket	O
are	O
each	O
shortened	O
by	O
one	O
character	O
and	O
placed	O
under	O
the	O
new	O
radix	O
node	O
in	O
a	O
set	O
of	O
new	O
array	O
nodes	O
.	O
</s>
<s>
Sorted	O
access	O
to	O
the	O
collection	O
is	O
provided	O
by	O
enumerating	O
keys	O
into	O
a	O
cursor	O
by	O
branching	O
down	O
the	O
radix	B-Data_Structure
trie	I-Data_Structure
to	O
assemble	O
the	O
leading	O
characters	O
,	O
ending	O
at	O
either	O
a	O
hash	B-Error_Name
bucket	O
or	O
an	O
array	O
node	O
.	O
</s>
<s>
Pointers	O
to	O
the	O
keys	O
contained	O
in	O
the	O
hash	B-Error_Name
bucket	O
or	O
array	O
node	O
are	O
assembled	O
into	O
an	O
array	O
that	O
is	O
part	O
of	O
the	O
cursor	O
for	O
sorting	O
.	O
</s>
<s>
Since	O
there	O
is	O
a	O
maximum	O
number	O
of	O
keys	O
in	O
a	O
hash	B-Error_Name
bucket	O
or	O
array	O
node	O
,	O
there	O
is	O
a	O
pre-set	O
fixed	O
limit	O
to	O
the	O
size	O
of	O
the	O
cursor	O
at	O
all	O
points	O
in	O
time	O
.	O
</s>
<s>
After	O
the	O
keys	O
for	O
the	O
hash	B-Error_Name
bucket	O
or	O
array	O
node	O
are	O
exhausted	O
by	O
get-next	O
(	O
or	O
get-previous	O
)	O
(	O
see	O
Iterator	O
)	O
the	O
cursor	O
is	O
moved	O
into	O
the	O
next	O
radix	O
node	O
entry	O
and	O
the	O
process	O
repeats	O
.	O
</s>
