AA tree

AA trees are named after their originator, Swedish computer scientist Arne Andersson.

An AA tree on the other hand only needs to consider two shapes due to the strict requirement that only right links can be red:

Whereas red–black trees require one bit of balancing metadata per node (the color), AA trees require O(log(log(N))) bits of metadata per node, in the form of an integer "level".

Then, as the call stack unwinds (assuming a recursive implementation of the search), it's easy to check the validity of the tree and perform any rotations as necessary.

This makes it necessary to continue checking the validity of the tree as the modifications bubble up from the leaves.

The one described by Andersson in his original paper is the simplest, and it is described here, although actual implementations may opt for a more optimized approach.

This approach was favored, because when laid down conceptually, it has three easily understood separate steps: However, we have to skew and split the entire level this time instead of just a node, complicating our code.