public BinarySearchTreeNode <T> RotateRR() { if (IsRightEmpty()) { throw new SBTNodeEmptyException(true); } BinarySearchTreeNode <T> pNode = this; BinarySearchTreeNode <T> cNode = pNode.Right; pNode.ChangeRightSubtree(cNode.Left); cNode.ChangeLeftSubtree(pNode); return(cNode); }
public BinarySearchTreeNode <T> RotateRL() { if (IsRightEmpty()) { throw new SBTNodeEmptyException(true); } else if (Left.IsLeftEmpty()) { throw new SBTNodeEmptyException(false); } BinarySearchTreeNode <T> pNode = this; BinarySearchTreeNode <T> cNode = pNode.Right; pNode.ChangeRightSubtree(RotateLL()); pNode.RotateRR(); return(cNode); }