将相应位置上冲突的所有关键词存放在同一链表中
1 #define KEYLENGTH 15 2 typedef char ElementType[KEYLENGTH+1]; 3 typedef int Index; 4 typedef struct LNode *ptrToLNode; 5 struct LNode 6 { 7 ElementType Data; 8 ptrToLNode Next; 9 }; 10 typedef ptrToLNode Position; 11 typedef ptrToLNode list; 12 typedef struct Hashnode *HashTable; 13 14 struct Hashnode{ 15 int TableSize; 16 list Heads; 17 }; 18 HashTable CreateHash(int TableSize){ 19 int i; 20 HashTable h; 21 h=(HashTable)malloc(sizeof(struct Hashnode));//申请哈希表空间 22 h->TableSize=TableSize;//哈希表空间大小 23 h->Heads=(list)malloc(TableSize* sizeof(struct LNode));//哈希表数组 24 for(i=0;i<TableSize;i++)//哈希表数组初始化 25 { 26 h->Heads[i].Data[0]='