赞
踩
/*hashtable.h*/
#include<iostream>
#include <string>
#include<vector>
using namespace std;
class Hashtable
{
private:
vector<pair<int,string>> hashtable[20];
public:
friend std::ostream& operator<<(std::ostream& out, const Hashtable& h);
int hashfunction(string s);
void add_hash(int key, string s);
bool delete_hash(string s);
int search(string s);
};
/*hashtable.cpp*/
#include"hashtable.h"
using namespace std;
std::ostream& operator<<(std::ostream& out,const Hashtable& h)
{
int i;
for(i=0;i<20;i++)
{
for(int j=0; j<(int)h.hashtable[i].size();j++)
out<<h.hashtable[i][j].first<<" "<<h.ha
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。