top of page

Hash Table

Information  

I first created two separate files within the visual studio program, the Source.cpp file and the Header.h file. The Source file holds the int main while the header file holds all the rest of the core code, it implements a “Key” and a “Value” which are also implemented into the templates that are present for the required functions. Then the hash table’s size and capacity is set, with the maximum capacity set to 10 (for sake of simplicity) and the starting size is set to 0. The hash table also incorporates the use of the modulus % in the hash table code. These keys and values are stored within an array that is created for the hash table to store a makeshift phone-book of names and numbers. The functions implemented into this are the user interaction using a switch case statement, which then allows the user to insert a key and value node into the hash table. These keys and values then store the user input name and number that the user has input, the other switch cases allow for the user to delete a node from the hash table, this searches for the user input key, then proceeds to delete the key and the value attached to that key. The last feature for the hash table is to display the current size of the table, by showing the current size, such as how many keys are currently stored within the array. The user is able to employ any of these features, with the last being to exit the program itself.

Code    

Below is the link to the code on in a Google Document

​

https://github.com/ZephielxNavares/Hash-Table

bottom of page