#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#define MAX_HASH_TABLE_LEN 10
using namespace std;
typedef struct _NODE
{
int data;
struct _NODE* next;
}NODE;
typedef struct _HASH_TABLE
{
NODE* value[MAX_HASH_TABLE_LEN];
}HASH_TABLE;
/*哈希表索引 _创建hash表()*/
HASH_TABLE* create_hash_table()
{
return (HASH_TABLE*)calloc(1, sizeof(HASH_TABLE));
}
/*数据所在的节点 _hash表当中寻找数据(哈希表索引,目标数据)*/
NODE* find_data_in_hash(HASH_TABLE* hashtable_index, int data)
{
if (NULL == hashtable_index)
return NULL;
NODE* node_index = NULL;
if (NULL == (node_index = hashtable_index->value[d
C/C++ 实现哈希表(hash table)
最新推荐文章于 2025-06-23 22:44:13 发布