简体   繁体   中英

Hashtable using generic lists implementation

Can anyone please help me with an implementation of a hashtable using generic lists? So far, I got this, can anyone please tell me if this is the right way to go?

typedef struct HashTable {
    int key_len;
    int data_len;
    int num_buckets;
    HashEntry *buckets;
} HashTable;

typedef struct HashEntry {
    void* key; 
    void* data;
    HashEntry* next; //list for collision resolution
} HashEntry;

This looks a lot more like a linked list than a hash table IMHO. A hash table should be something like an associative array with the hash as the key and the record as the value.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM