www.delorie.com/gnu/docs/avl/libavl_91.html   search  
 
Buy GNU books!


GNU libavl 2.0.1

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.2 Data Types

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. */
struct avl_node 
{ struct avl_node *avl_link[2]; /* Subtrees. */ void *avl_data; /* Pointer to data. */ signed char avl_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.


  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003