Skip to content

Zaphoood/hashtable.c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Basic implementation of a hash table

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published