Skip to content

Latest commit

 

History

History
19 lines (10 loc) · 851 Bytes

File metadata and controls

19 lines (10 loc) · 851 Bytes

Hash table

This is a simple hash table implemented in C using no external libraries.

It is by no means meant to be used in an actual application; instead, my goal was to experiment and get an understanding of how hash tables work under the hood.

Compiling

To compile, run ./build.sh, which will generate an executable hashtable.

Implementation

This implementation uses open adressing in order to handle collisions.

Before an insert operation and after a delete operation is performed, the hash table is resized, such that the load factor always stays between 0.25 and 0.5.

When resizing, the new capacity is always chosen to be the smallest prime number greater than the requested capacity, which helps to avoid collisions.

A linear probing function with an interval of 1 is used.