Weight balanced tree right rotation (
Pascal version
available)
tree rrot( t ) tree t; { tree temp; temp = t; t = t->left; temp->left = t->right; t->right = temp; /*** adjust weight ***/ t->weight = temp->weight; temp->weight = wt( temp->left ) + wt( temp->right ); return( t ); }
C
source (3414.rrot.c)
Pascal
source (3414.rrot.p)
©
Addison-Wesley
Publishing Co. Inc.