Week 10

Published

June 17, 2025

VL 19 - 17.06.25

Complexity / Depth of Anderson Trees (“AA-Tree”)

properties of anderson trees:

  • 0: search-tree condition
  • 1-3: horizontal edges
  • 4: all nodes that are not at the lowest level, i.e. not the smallest sentinel distance, have exactly two children

Main point idea of Anderson: 0-4 are by appropriate impelemntation of insert and remove always satisfiable.

Last if of insert:

if node.right is not None and node.right.right is not None and \
    node.dist == node.right.right.dist: # 
        node = rotate_left(node)
        node.dist += 1 # this node has two children, because in hte midle of the chain in the tree

Consequence for the depth:

  • lowest level: k = k_min => N_min(k_min) = 1
  • higher levels:
    • Case 1: no horizontal edge: N_min(k) = 1 + 2 N_min(k - 1)
    • Case 2: right horizontal edge: N_min(k) = 1 + N_min(k - 1) + 1 + 2 N_min(k - 1) = 2 + 3 N_min(k - 1)

Case 1 is corresponds exactly to the perfect tree, k = log_2(N + 1)

  • Summary:
    • k_max <= log_2(N + 1) always holds (k_max is the distance to the root)
    • there are never two subsequent horizontal edges => d <= 2k_max
    • \(\Rightarrow\) d <= 2 log_2(N + 1) (basically same complexity as a perfectly balanced tree).

anderson-insert