This repository contains a C++ implementation of a chaining hash table, along with a custom hash function. The hash table is designed to categorize and store string tokens loaded from input files. The project includes sample input cases, testing scripts, and a Makefile for easy compilation and testing.
A chaining hash table is a type of hash table where each bucket (or slot) contains a linked list of elements. It's used to efficiently store and retrieve key-value pairs. In this project, we implement a chaining hash table to categorize and store string tokens based on a custom hash function.
- Implementation of a chaining hash table in C++.
- Custom hash function designed to sort strings into corresponding slots in the hash table.
- Sample input files and test cases provided.
- Makefile for easy compilation and testing.
- Ability to create custom input files and test the robustness of the hash function design.
To use this implementation, follow these steps:
- Clone the repository to your local machine.
- Compile the code using the provided Makefile.
- Run the program with a specified input file:
./run < testfilename.txt- Analyze the output to see the contents of the hash table, slot lengths, and standard deviation.
The input file format should adhere to the following rules:
- The first line specifies the number of hash table slots (k), where 5 <= k <= 100.
- The following lines consist of one token per line, in upper and lower case letters.
- There are no duplicate tokens in a single input file.
- The number of tokens (N) does not exceed 500.
Example (testfilename.txt):
5
Amazon
Boeing
apple
Applebee
abandon
banana
elephant
boring
barbaric
This project is licensed under the MIT License.