Red Black Tree deletion of root
<p>My red black tree algorithm for deletion works well unless I delete the root. Where only one of the child is saved and the rest of the tree values are lost.</p>

<p>I believe the problem is in the <code>removeNode()</code> method in the lines where </p>

<pre><code>if (remove == root)
{
    root = child;
} 
</code></pre>

<p>Here are the methods used for deletion: </p>

<pre><code>//Searching for value to remove
public void removeSearch(int value)
{
    RedBlackNode rt = root;
    while (rt != sentinel)
    {
        int compare = value.CompareTo(rt.getItem());
        if (compare == 0)
        {
            if (rt.getLeft() == sentinel || rt.getRight() == sentinel)
            {
                removeNode(rt);
            }
            else
            {
                RedBlackNode successor = inOrderSuccessor(rt);
                rt.setItem(successor.getItem());
                removeNode(rt);                        
            }
            return;
        }
        else
        {
            rt = rt.getChild(compare);
            //return true;
        }
    }
}

protected RedBlackNode inOrderSuccessor(RedBlackNode node)
{
    RedBlackNode descendant = node.getRight();

        while (descendant.getLeft() != sentinel)
        {
            descendant = descendant.getLeft();
        }
    return descendant;
}

protected void removeNode(RedBlackNode remove)
{
    count -= 1;
    RedBlackNode child;
    if (remove.getLeft() != sentinel)
    {
        child = remove.getLeft();
    }
    else
    {
        child = remove.getRight();
    }
    linkParentAndChild(remove.getParent(), child, comparison(remove, remove.getParent()));

    if(remove==root)
    {
        root = child;
    }
    if(remove.isBlack())
    {
        DeleteFix(child);
    }
}

protected void DeleteFix(RedBlackNode node)
{
    while((node!=root)&amp;&amp;(node.isBlack()))
    {
        RedBlackNode parent = node.getParent();
        int compare = comparison(node, parent);
        RedBlackNode sibling = parent.getChild(-compare);
        if(sibling.isRed())
        {
            sibling.setBlack();
            parent.setRed();
            rotate(-compare, parent);
            sibling = node.getParent().getChild(-compare);
        } 
        if(sibling.hasTwoBlackChildren())
        {
            sibling.setRed();
            node = node.getParent();
        }else
        {
            if(sibling.getChild(-compare).isBlack())
            {
                sibling.getChild(compare).setBlack();
                sibling.setRed();
                rotate(compare, sibling);
                sibling = parent.getChild(-compare);
            }
            sibling.setColour(parent.getColour());
            parent.setBlack();
            sibling.getChild(-compare).setBlack();
            rotate(-compare, parent);
            node = root;
        }
    }
    node.setBlack();
}
</code></pre>

<p>Any help would be great. Thanks</p>