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.
196. <RB functions 196> = <BST creation function; bst => rb 30> <BST search function; bst => rb 31> <RB item insertion function 197> <Table insertion convenience functions; tbl => rb 592> <RB item deletion function 220> <AVL traversal functions; avl => rb 178> <AVL copy function; avl => rb; avl_balance => rb_color 185> <BST destruction function; bst => rb 84> <Default memory allocation functions; tbl => rb 6> <Table assertion functions; tbl => rb 594>
This code is included in 193.