数据结构与算法分析——c语言描述 练习5.10 答案
不知道这道题是现实意义在哪,就是免去了刚开始给所有KindOfEntry赋值为empty。
hashQuad.h
typedef int ElementType_hash;
#ifndef _HashQuad_H
#define _HashQuad_H
typedef unsigned int Index;
typedef Index Position_hash;
struct HashTbl;
typedef struct HashTbl* HashTable;
HashTable initializeTable(int tableSize);
void destroyTable(HashTable h);
Position_hash find(ElementType_hash key, HashTable h);
HashTable insert(ElementType_hash key, HashTable h);
HashTable rehash(HashTable h);
ElementType_hash retrive(Position_hash p, HashTable h);
int isLegitimate(Position_hash pos, HashTable h);
#endif
hashQuad.cpp
#include"hashQuad.h"
#include"fatal.h"
#include<math.h>
#include"stack.h"
#define MinTableSize 5
struct HashEntry {
ElementType_hash element;
int whe