1、hash_table.h
#include <iostream>
3 #include <string>
4 #include <string.h>
5 #include <vector>
6 #include <stdio.h>
7 using namespace std;
8
9 struct table_node
10 {
11 int _key;
12 string _value;
13 struct table_node *next;
14 table_node(const int key,const string &value)
15 :_key(key),_value(value),next(NULL)
16 {}
17 };
18
19
20 class hash_table
21 {
22 private:
23 vector<table_node*> vector_node;
24 size_t size;
25 private:
26 size_t fun_index(const int key)
27 {
28 return key % vector_node.size();
29 }
30 size_t get_size()
31 {
32 const int len=10;
33 static size_t arr[len]={53,97,193,389,769,1543,3079,6151,12289,24593};
34 static int i=0;
35 return arr[i++];
36 }
37 vo