1
0

table.h 731 B

123456789101112131415161718192021222324
  1. #ifndef MAX_SIZE
  2. #define MAX_SIZE (1024 ^ 2)
  3. // 定义哈系表的范围(也就是通过time_33哈系后的值在跟MAX_SIZE整除,从而限定了范围)
  4. // 一个捅,由key和value组成,同时next为链表所用[解决哈系冲突]
  5. typedef struct HashNode
  6. {
  7. char *key;
  8. char *value;
  9. struct HashNode *next; // Hash冲突
  10. } HashNode;
  11. // 一张哈希表,由一个指针组成,该指针起数组作用,内部存储捅的指针
  12. typedef struct HashTable{
  13. struct HashNode **HashNode; // 这是一个指针数组
  14. } HashTable;
  15. HashTable *make_HashTable();
  16. HashNode *make_HashNode(char *key, char *value);
  17. int login_node(HashTable *ht, HashNode *hn);
  18. HashNode *find_node(HashTable *ht, char *key);
  19. #endif