用 散 列 表 实 现 简 单 的 英 文 词 典 2011 年4 月4 日星期一 一 . 头 文 件 : //文件名:Word.h //单词类的定义 #include #include class Word{ friend ostream& operator<<(ostream &os, const Word & obj)//重载输出函数 { int n=strlen(obj.word); for(int i=0; i #include template class openHashTable{ private: struct node{//私有结点 Type data; struct node *next; node(){ next = NULL; } node(Type &d){ data = d; next = NULL;} }; node **array; int(*key)(const Type &x);//关键字 static int defaultKey(const int &k) { return k; }//缺省值 int size; public: openHashTable(int length =101 , int(* f)(const Type &x) = defaultKey); ~ openHashTable(); int find(Type &x); //查找函数 bool insert(Type &x); //插入函数 bool remove( Type &x); //删除函数 void output(); //输出词典函数 }; //======================开散列表函数的实现===================================== //构造函数的实现 template openHashTable::openHashTable(int length, int(*f)(const Type &x)) { size = length; array = new node *[size]; key = f; for(int i=0; i openHashTable::~ openHashTable() { node *p, *q; for(int i=0; inext; delete p; p = q; }while(p!=NULL); } delete [] array; } //插入函数的实现 template bool openHashTable::insert(Type...