概述
已知哈希表装填因子小于1,哈希函数为关键字第一个字母在字母表中的序号,处理冲突的方法为线性探测开放地址法,编写一个按第一个字母的顺序输出哈希表中所有关键字的程序。
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#define m 29
#define MAXSIZE 20
#define SUCCESS 1
#define UNSUCCESS 0
#define DUPLICATE -1
typedef int Status;
typedef struct
{
char s[MAXSIZE];
}String;
typedef struct
{
String H[m];
int num;
}HashTable;
int Hash(String s);
void Collision(int *p,int c);
Status SearchHash(HashTable T,String k,int *p,int *c);
Status InsertHash(HashTable *T,String e);
void Output(HashTable T);
int main()
{
HashTable T;
int i;
for(i=0;i<m;i++)
T.H[i].s[0]='