📄 hashtable.cpp
字号:
#include <iostream.h>
typedef int KeyType;
#include "DataType.h"
#include "HashTable.h"
void main(void)
{
HashTable myHashTable(13);
DataType a[] = {180,750,600,430,541,900,460}, item;
int i, j, n = 7;
for(i = 0; i < n; i++)
myHashTable.Insert(a[i]);
for(i = 0; i < n; i++)
{
j = myHashTable.Find(a[i]);
if(j > 0)
{
item = myHashTable.GetValue(j);
cout << "j = " << j << " ht[] = " << item.key << endl;
}
}
int k = myHashTable.IsIn(430);
if(k == 1) cout << "数据元素430在哈希表中";
else cout << "数据元素430不在哈希表中";
myHashTable.Delete(430);
k = myHashTable.IsIn(430);
if(k == 1) cout << "\n数据元素430在哈希表中";
else cout << "\n数据元素430不在哈希表中";
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -