//构造哈希表(利用线性探测再散列法处理冲突)
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
int main(){
int H[11] = {0};
int k[]={22,41,53,46,30,13,01,67};
for(int i = 0; i < 8;i++)
{
int j = (3*k[i])%11;
int flag = 1;
while(H[j] != 0)
{
j = (3*(j+flag))%11;
flag++;
}
H[j] = k[i];
}
double S = 0;
S = 1/2.0 * (1+1.0/(1-8.0/11.0));
int s = S;
printf("%d\n",s);
return 0;
}
noj23、构造哈希表
最新推荐文章于 2022-05-06 23:16:31 发布