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


GNU libavl 2.0.1

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

13.1 Data Types

Like any right-threaded tree node, an RTRB node has a right tag, and like any red-black tree node, an RTRB node has a color, either red or black. The combination is straightforward, as shown here.

 
/* Color of a red-black node. */
enum rtrb_color 
{ RTRB_BLACK, /* Black. */ RTRB_RED /* Red. */ }; /* Characterizes a link as a child pointer or a thread. */ enum rtrb_tag
{ RTRB_CHILD, /* Child pointer. */ RTRB_THREAD /* Thread. */ }; /* A threaded binary search tree node. */ struct rtrb_node
{ struct rtrb_node *rtrb_link[2]; /* Subtrees. */ void *rtrb_data; /* Pointer to data. */ unsigned char rtrb_color; /* Color. */ unsigned char rtrb_rtag; /* Tag field. */ };
This code is included in @refalso{452


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