private static void Rotate(ref AvlNode <T> root, int left, int right)
        {
            var newRoot = root.Children[left];

            root.Children[left]     = newRoot.Children[right];
            newRoot.Children[right] = root;

            root.UpdateSizes();
            newRoot.UpdateSizes();

            root = newRoot;
        }
        private static void BalanceIfRightIsHeavy(ref AvlNode <T> node)
        {
            node.UpdateSizes();

            if (node.Balance < -1)
            {
                if (node.Right.Balance > 0)
                {
                    var child = node.Right;
                    RotateRight(ref child);
                    node.Right = child;
                }
                RotateLeft(ref node);
            }
        }