Next: LeftRotate, Previous: Insert, Up: Private Routines
Join two trees.
#include <rbtree/rbtree.h>static void JoinTrees( Tree *tree1, Tree *tree2 );
Tree *tree1
- the tree to merge the second into
Tree *tree2
- the tree to merge into the first tree
This routine joins two trees, detaching nodes from the second and inserting them in the first. As the second tree is completely gutted, the routine doesn't spend time keeping its redblack nature intact during the process.