摘要: #include <stdio.h> #include <math.h> #include <string.h> #include <malloc.h> typedef enum {false,true } bool; bool IsPrime(int n) { if(n==0||n==1) ret 阅读全文
posted @ 2020-03-06 21:14 跃鱼 阅读(1098) 评论(0) 推荐(0) 编辑
摘要: 注意:第i次冲突后第i次探测的散列地址 Hi=(H(key)+di)%p #include <stdio.h> #include <string.h> #include <math.h> #include <malloc.h> typedef struct { int key; char value 阅读全文
posted @ 2020-03-06 19:43 跃鱼 阅读(839) 评论(0) 推荐(0) 编辑
摘要: 解题思路: 1、初始化散列表,用于标记散列地址是否已用 2、构造结构体,(关键字去重)记录关键字的值和地址 3、读入数据,判断该关键字是否重复查询 4、用辅助数组记录每个关键字的地址,遍历输出 #include <stdio.h> #include <string.h> typedef struct 阅读全文
posted @ 2020-03-06 16:37 跃鱼 阅读(619) 评论(0) 推荐(0) 编辑
摘要: 解题思路: 用散列表(链表结构) 1、计算散列表长度(取比输入数据大一点的素数p) 2、构造散列函数 3、读入数据,求出散列位置插入 4、一边遍历散列表,一边求出现最多的电话狂人 #include <stdio.h> #include <malloc.h> #include <string.h> # 阅读全文
posted @ 2020-03-06 11:54 跃鱼 阅读(312) 评论(0) 推荐(0) 编辑