📄 hashtable.h
字号:
// HashTable.h: interface for the HashTable class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_HASHTABLE_H__31E4E0A3_2CF4_4933_A8B6_77FB3BFF4E70__INCLUDED_)
#define AFX_HASHTABLE_H__31E4E0A3_2CF4_4933_A8B6_77FB3BFF4E70__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include"SortedChain.h"
class BadInput{
public:
BadInput(){}
};
class NoMem{
public:
NoMem(){}
};
class element{
public:
int code;
unsigned long key;
operator long(){return key;}
/* bool operator ==(unsigned long k){
return key==k;
}*/
//friend void Compress();
element& operator =(unsigned long y){
key=y;return *this;}
};
class ele{
// friend void Output1(int);
// friend void Decompress();
public:
int prefix;
unsigned char suffix;
};
template<class E,class K>
class HashTable{
public:
HashTable(int div=11);
~HashTable(){
delete[] ht;
}
bool Search(const K& k,E& e){
return ht[k%D].Search(k,e);
}
HashTable<E,K>& Insert( E& e){
ht[e%D].DistinctInsert(e);
return *this;
}
private:
int D;
SortedChain<E,K>* ht;
};
template<class E,class K>
HashTable<E,K>::HashTable(int div){
D=div;
ht=new SortedChain<E,K>[D];
}
#endif // !defined(AFX_HASHTABLE_H__31E4E0A3_2CF4_4933_A8B6_77FB3BFF4E70__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -