void insertRedBlack(Tree t, Item it)
{
t->root = insertRB(t->root, it, 0);
t->root->colour = BLACK;
}
Link insertRB(Link t, Item it, int inRight)
{
if (t == NULL) return newNode(it,RED);
if (red(L(t)) && red(R(t))) {
// split 4-node and promote middle value
// performed as we descend tree
}
// recursive insert cases (cf. regular bst)
// then re-arrange links/colours after insert
return t';
}
|