void insert( key, r )
typekey key; dataarray r;
{ extern int n;
int i, inc, ii, init, j, jj;
init = hashfunction( key );
inc = increment( key );
for (i=0; i<=n; i++)
for (j=i; j>=0; j--)
{
jj = (init + j*inc) % m;
ii = (jj + (i-j)*increment(r[jj].k)) % m;
if ( empty(r[ii]) || deleted(r[ii]) )
{
/*** move record forward ***/
r[ii] = r[jj];
/*** insert new in r[jj] ***/
r[jj].k = key;
n++;
return;
}
};
Error /*** table is full ***/;
}
|