void insert( key, r )
typekey key; dataarray r;
{ extern int n;
int i, inc, last;
i = hashfunction( key ) ;
inc = increment( key );
last = (i+(m-1)*inc) % m;
while ( i!=last && !empty(r[i]) && !deleted(r[i]) && r[i].k!=key )
i = (i+inc) % m;
if ( empty(r[i]) || deleted(r[i]) )
{
/*** insert here ***/
r[i].k = key;
n++;
}
else Error /*** table full, or key already in table ***/;
}
|