We need to define data types for AVL trees like we did for BSTs. AVL
tree nodes contain all the fields that a BST node does, plus a field
recording its balance factor:
/* An AVL tree node. */
structavl_node {structavl_node *avl_link[2]; /* Subtrees. */
void *avl_data; /* Pointer to data. */
signedcharavl_balance; /* Balance factor. */
};
This code is included in @refalso{142
We're using avl_ as the prefix for all AVL-related identifiers.
The other data structures for AVL trees are the same as for BSTs.
Please take a moment to fill out
this visitor survey You can help support this site by
visiting the advertisers that sponsor it! (only once each, though)