tree insert( key, t, lev )
typekey key[];
tree t;
int lev;
{
int i;
if ( t==NULL ) t = NewNode( key );
else { for ( i=0; ik[i]; i++ );
if ( i==K ) Error /*** Key already in table ***/;
else if ( key[lev] > t->k[lev] )
t->right = insert( key, t->right, (lev+1)%K );
else t->left = insert( key, t->left, (lev+1)%K );
}
return( t );
};
|