C++ 实现哈希表的实例
该散列表的散列函数采用了除法散列函数、乘法散列函数、全域散列函数,每一个槽都是使用有序单向链表实现。
实现代码:
LinkNode.h
#include<iostream>
using namespace std;
class Link;
class LinkNode
{
private:
int key;
LinkNode* next;
friend Link;
public:
LinkNode():key(-1),next(NULL){}
LinkNode(int num):key(num),next(NULL){}
int Getk