hashtable.h

来自「编译原理的作业 编译器」· C头文件 代码 · 共 34 行

H
34
字号
#ifndef HASHTABLE_H_
#define HASHTABLE_H_

#include "BinarySearchTree.h"

#define PRIME  217

template <class T>
class HashTable
{
public:
	void Insert(const T& elem);
	T Exsits(const T& elem);
private:
	BinarySearchTree<T> _tree[PRIME];
};

int Key(const std::string& elem);


template <class T>
void HashTable<T>::Insert(const T& elem)
{
	_tree[Key(elem)].Insert(elem);
}

template <class T>
T HashTable<T>::Exsits(const T& elem)
{
	return _tree[Key(elem)].Exists(elem);
}

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?