The next data-structure is the hash table. The hash table solves the problem of off having some key associated with your data and wanting to get the entry in a table.

In an normal array you would have to search the whole list. The same is true for linked list. A hash table solves this problem by using the key as the index into an array.

The key is normally referred to as the hash and is computed by putting your data trough a hash-function.

The first problem you can easily imagine is, that two different entries get the same hash. This is called a collision. There are different strategies of solving those collisions. Some are inline solutions and use the next indices to store the entry others require other data-structures.

Our hash-table will use a dlinked-list for these collision. If we detect a collision the new entry is saved as the head of the linked list.

A downside of a hash table is that it is hard to balance wasted space and avoiding collision. You have to have a good hash function and good testing to determine with what kind of space you can get away with.

You task is to implement the hash table.