This project implements and analyzes different hash functions for inserting keys into a hash table using separate chaining (linked lists) for collision resolution. The input keys are randomly generated alphanumeric strings stored in a file.
main.cpp: Main source code containing all hash table logic.cle.txt: Contains randomly generated alphanumeric keys.hcode.dev,hcode.layout,Makefile.win,hcode.exe,main.o: IDE project and compiled output files (Dev-C++/Windows-specific).
- Generate a file of random alphanumeric keys (
cle.txt). - Implement three different hash functions to test collision performance.
- Insert keys into a hash table using linked lists (chaining).
- Display the number of elements in each hash table bucket.
- Clean up memory by freeing the hash table.
- Function 1: Multiplies character value by 19.
- Function 2: Squares character value and multiplies by 19.
- Function 3: Same as function 2, but also multiplies by the character's position.
When running the program, the following menu is shown:
menu : 1: creer le fichier 2: init tab hash 3: creer tab hash 4: afficher nombre des elem 5: liberer 6: quitte
If you're using Dev-C++:
- Open the project via
hcode.dev. - Compile and run the project.
Or compile manually (e.g., using g++):
g++ -o hash_program main.cpp
./hash_program