<s>
An	O
AA	B-Data_Structure
tree	I-Data_Structure
in	O
computer	B-General_Concept
science	I-General_Concept
is	O
a	O
form	O
of	O
balanced	B-Data_Structure
tree	I-Data_Structure
used	O
for	O
storing	O
and	O
retrieving	O
ordered	O
data	O
efficiently	O
.	O
</s>
<s>
AA	B-Data_Structure
trees	I-Data_Structure
are	O
named	O
after	O
Arne	O
Andersson	O
,	O
the	O
one	O
who	O
theorized	O
them	O
.	O
</s>
<s>
AA	B-Data_Structure
trees	I-Data_Structure
are	O
a	O
variation	O
of	O
the	O
red	O
–	O
black	O
tree	O
,	O
a	O
form	O
of	O
binary	B-Language
search	I-Language
tree	I-Language
which	O
supports	O
efficient	O
addition	O
and	O
deletion	O
of	O
entries	O
.	O
</s>
<s>
Unlike	O
red	O
–	O
black	O
trees	O
,	O
red	O
nodes	O
on	O
an	O
AA	B-Data_Structure
tree	I-Data_Structure
can	O
only	O
be	O
added	O
as	O
a	O
right	O
subchild	O
.	O
</s>
<s>
This	O
results	O
in	O
the	O
simulation	O
of	O
a	O
2	B-Data_Structure
–	I-Data_Structure
3	I-Data_Structure
tree	I-Data_Structure
instead	O
of	O
a	O
2	B-Data_Structure
–	I-Data_Structure
3	I-Data_Structure
–	I-Data_Structure
4	I-Data_Structure
tree	I-Data_Structure
,	O
which	O
greatly	O
simplifies	O
the	O
maintenance	O
operations	O
.	O
</s>
<s>
An	O
AA	B-Data_Structure
tree	I-Data_Structure
on	O
the	O
other	O
hand	O
only	O
needs	O
to	O
consider	O
two	O
shapes	O
due	O
to	O
the	O
strict	O
requirement	O
that	O
only	O
right	O
links	O
can	O
be	O
red	O
:	O
</s>
<s>
Whereas	O
red	O
–	O
black	O
trees	O
require	O
one	O
bit	O
of	O
balancing	O
metadata	O
per	O
node	O
(	O
the	O
color	O
)	O
,	O
AA	B-Data_Structure
trees	I-Data_Structure
require	O
O(log(log(N )	O
)	O
)	O
bits	O
of	O
metadata	O
per	O
node	O
,	O
in	O
the	O
form	O
of	O
an	O
integer	O
"	O
level	O
"	O
.	O
</s>
<s>
The	O
following	O
invariants	O
hold	O
for	O
AA	B-Data_Structure
trees	I-Data_Structure
:	O
</s>
<s>
These	O
are	O
more	O
restrictive	O
constraints	O
than	O
the	O
analogous	O
ones	O
on	O
red	O
–	O
black	O
trees	O
,	O
with	O
the	O
result	O
that	O
re-balancing	O
an	O
AA	B-Data_Structure
tree	I-Data_Structure
is	O
procedurally	O
much	O
simpler	O
than	O
re-balancing	O
a	O
red	O
–	O
black	O
tree	O
.	O
</s>
<s>
Insertions	O
and	O
deletions	O
may	O
transiently	O
cause	O
an	O
AA	B-Data_Structure
tree	I-Data_Structure
to	O
become	O
unbalanced	O
(	O
that	O
is	O
,	O
to	O
violate	O
the	O
AA	B-Data_Structure
tree	I-Data_Structure
invariants	O
)	O
.	O
</s>
<s>
input	O
:	O
T	O
,	O
a	O
node	O
representing	O
an	O
AA	B-Data_Structure
tree	I-Data_Structure
that	O
needs	O
to	O
be	O
rebalanced	O
.	O
</s>
<s>
output	O
:	O
Another	O
node	O
representing	O
the	O
rebalanced	O
AA	B-Data_Structure
tree	I-Data_Structure
.	O
</s>
<s>
input	O
:	O
T	O
,	O
a	O
node	O
representing	O
an	O
AA	B-Data_Structure
tree	I-Data_Structure
that	O
needs	O
to	O
be	O
rebalanced	O
.	O
</s>
<s>
output	O
:	O
Another	O
node	O
representing	O
the	O
rebalanced	O
AA	B-Data_Structure
tree	I-Data_Structure
.	O
</s>
<s>
As	O
in	O
most	O
balanced	B-Data_Structure
binary	I-Data_Structure
trees	I-Data_Structure
,	O
the	O
deletion	O
of	O
an	O
internal	O
node	O
can	O
be	O
turned	O
into	O
the	O
deletion	O
of	O
a	O
leaf	O
node	O
by	O
swapping	O
the	O
internal	O
node	O
with	O
either	O
its	O
closest	O
predecessor	O
or	O
successor	O
,	O
depending	O
on	O
which	O
are	O
in	O
the	O
tree	O
or	O
on	O
the	O
implementor	O
's	O
whims	O
.	O
</s>
<s>
The	O
performance	O
of	O
an	O
AA	B-Data_Structure
tree	I-Data_Structure
is	O
equivalent	O
to	O
the	O
performance	O
of	O
a	O
red	O
–	O
black	O
tree	O
.	O
</s>
<s>
While	O
an	O
AA	B-Data_Structure
tree	I-Data_Structure
makes	O
more	O
rotations	O
than	O
a	O
red	O
–	O
black	O
tree	O
,	O
the	O
simpler	O
algorithms	O
tend	O
to	O
be	O
faster	O
,	O
and	O
all	O
of	O
this	O
balances	O
out	O
to	O
result	O
in	O
similar	O
performance	O
.	O
</s>
<s>
A	O
red	O
–	O
black	O
tree	O
is	O
more	O
consistent	O
in	O
its	O
performance	O
than	O
an	O
AA	B-Data_Structure
tree	I-Data_Structure
,	O
but	O
an	O
AA	B-Data_Structure
tree	I-Data_Structure
tends	O
to	O
be	O
flatter	O
,	O
which	O
results	O
in	O
slightly	O
faster	O
search	O
times	O
.	O
</s>
