Node Remove(Node t, object key, Box found)
{
if (t == null)
return null;
int c = DoCompare(key, t.Key);
if (c == 0)
{
found.Val = t;
return Append(t.Left, t.Right);
}
Node del = c < 0 ? Remove(t.Left, key, found) : Remove(t.Right, key, found);
if (del == null && found.Val == null)
return null;
if (c < 0)
return (t.Left is Black)
? BalanceLeftDel(t.Key, t.Val, del, t.Right)
: MakeRed(t.Key, t.Val, del, t.Right);
return (t.Right is Black)
? BalanceRightDel(t.Key, t.Val, t.Left, del)
: MakeRed(t.Key, t.Val, t.Left, del);
}