Better distribution but slower.
// Create new entry Entry *new_entry = (Entry*)malloc(sizeof(Entry)); new_entry->key = strdup(key); new_entry->value = strdup(value); new_entry->next = dict->buckets[index]; dict->buckets[index] = new_entry; dict->count++; c program to implement dictionary using hashing algorithms
unsigned long hash_sdbm(const char *str) unsigned long hash = 0; int c; while ((c = *str++)) hash = c + (hash << 6) + (hash << 16) - hash; return hash; Better distribution but slower