private Replace ( Node t, object key, object val ) : Node | ||
t | Node | |
key | object | |
val | object | |
return | Node |
Node Replace(Node t, object key, object val)
{
int c = DoCompare(key, t.Key);
return t.Replace(t.Key,
c == 0 ? val : t.Val,
c < 0 ? Replace(t.Left, key, val) : t.Left,
c > 0 ? Replace(t.Right, key, val) : t.Right);
}