map
A hashmap implementation in C11 with djb2 hash function
The hashmap algorithm consist of a bucket with a pair of key and values and a hash value that will to index the address of the correct bucket
Some implementations added a Linked List to solve the Hash Collision problem
How to build this project
Just type
mkdir build
cd build
cmake ..
How to see the result
./map 2> /dev/null
Dev information
The default hash algorithm
/* The best string hash function, created by Dan Bernstein */
unsigned long djb2_hash (unsigned char *str)
{
unsigned long hash = 5381;
int c;
while ((c = *str++))
/* HASH * 33 + C */
hash = ((hash << 5) + hash) + c;
return hash;
}