function search( key : typekey; var r : dataarray ) : integer;
var i, inc, last : integer;
begin
i := hashfunction( key ) ;
inc := increment( key ) ;
last := (i+(n-1)*inc) mod m;
while (i<>last) and (not empty(r[i])) and (r[i].k<>key) do
i := (i+inc) mod m;
if r[i].k=key then search := i {*** found(r[i]) ***}
else search := -1; {*** notfound(key) ***}
end;
|