Tree rotation can be used to rebalance the tree, because the upon subtree decrease the height by one while the down subtree increase the height by one. The order of the tree will keep the same
Right rotation:
Tree* pivot=root->left;
root->left=Root->left->right;
pivot->right=root;
root=pivot;
Dec 24, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment