Implements AVL tree