阅读背景:

C++实现哈希表的创建,销毁,键值插入与删除

来源:互联网 

/*
* HashTable.h
*
*  Created on: Nov 19, 2015
*      Author: chris
*/

#pragma once

#include <iostream>

const int numofsizes = 7;
const int hashsize[] = { 11, 19, 31, 41, 53, 61, 71 };

typedef int KeyType;
typedef int ElemType;

struct HashCell{
	bool null_key;
	KeyType key;
	HashCell() : null_key(true), key(0) {}
};

struct HashTable{
	HashCell * cells;
	int count;
	int sizeindex;
};


bool HashTableInit(HashTable & H);
void HashTableDestroy(HashTable & H);

int  HashTableHashKeyDirectAddr(HashTable & H, KeyType K);

bool HashTableSearchKey(HashTable & H, KeyType K, int& p, int& c);
bool HashTableInsertKey(HashTable & H, KeyType K);
bool HashTableDeleteKey(HashTable & H, KeyType K);

void HashTableDisplay(HashTable & H);
/*
* HashTable.h
*
*  Created on: Nov 19, 20



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: