6.3 Operations [ToC] [Index]     [Skip Back] [Skip Fwd]     [Prev] [Up] [Next]

Now we'll implement for RB trees all the operations that we did for BSTs. Everything but the insertion and deletion function can be borrowed either from our BST or AVL tree functions. The copy function is an unusual case: we need it to copy colors, instead of balance factors, between nodes, so we replace avl_balance by rb_color in the macro expansion.

198. <RB functions 198> =
<BST creation function; bst => rb 31>
<BST search function; bst => rb 32>
<RB item insertion function 199>
<Table insertion convenience functions; tbl => rb 594>
<RB item deletion function 222>
<AVL traversal functions; avl => rb 180>
<AVL copy function; avl => rb; avl_balance => rb_color 187>
<BST destruction function; bst => rb 85>
<Default memory allocation functions; tbl => rb 7>
<Table assertion functions; tbl => rb 596>

This code is included in 195.