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