Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //rotating methods to balance the tree accordingly
- private void rotateLeft(ref Node<T> tree)
- {
- if (tree.Right.BalanceFactor > 0)
- {
- rotateRight(ref tree.Right);
- }
- Node<T> newRoot = tree.Right;
- tree.Right = tree.Right.Left;
- newRoot.Left = tree;
- tree = newRoot;
- }
- private void rotateRight(ref Node<T> tree)
- {
- Node<T> newRoot = tree.Left;
- tree.Left = tree.Left.Right;
- newRoot.Right = tree;
- tree = newRoot;
- }
Advertisement
Add Comment
Please, Sign In to add comment