Add avl utilities

This PR introces a few utilities for use in recursive algorithms like `avl_union()`.