write-a-hash-table icon indicating copy to clipboard operation
write-a-hash-table copied to clipboard

✏️ Learn how to write a hash table in C

Results 27 write-a-hash-table issues
Sort by recently updated
recently updated
newest added

> It is possible that hash_b will return 0, reducing the second term to 0. This will cause the hash table to try to insert the item into the same...

Hi, this is a great tutorial. Thank you so much for writing it. I went from knowing almost nothing about implementing a hash table to feeling like I could do...

The pseduo-code ```function hash(string, a, num_buckets): hash = 0 string_len = length(string) for i = 0, 1, ..., string_len: hash += (a ** (string_len - (i+1))) * char_code(string[i]) hash =...

Currently the count variable would always decrement even if the key is not in the table. You can also return from the function directly if a deletable item has been...

Hi, i follow your tutorial to write the code, and found `ht_del_hash_table` function need to skip the deleted item, or there would be an error.

Hi, great tutorial. I'm curious about the insert function described in ch. 5, after the "update" modification. As it stands, wouldn't the function skip over deleted slots and add the...

1. Add lost C description for 03 and 04 code section in markdown

Since what ht_update actually does is deleting the item and insert it Can we just write it as: ``` void ht_insert(ht_hash_table* ht, const char* key, const char* value) { ht_delete(ht,...

In the pseudo code: ``` function hash(string, a, num_buckets): hash = 0 string_len = length(string) for i = 0, 1, ..., string_len: hash += (a ** (string_len - (i+1))) *...