Question: Hello, I need help with this C++ program. The requeriments are kind of confusing. I appreciate the help. Thanks. Requeriments: Hash Table Hashing Algorithm Hash
Hello, I need help with this C++ program. The requeriments are kind of confusing. I appreciate the help. Thanks.
Requeriments:
Hash Table
Hashing Algorithm
Hash Index
Description
Write a program that provides for searching students by their ids using hash table. The program will first input students one by one from a file (insert.txt) and insert them into hash table. Then it will input students one by one from a text file (search.txt) and perform searches for them in the hash table. It will keep a record of searches when required and display the summary results.
Implementation
Class StudentHT
Create a class StudentHT that provides for the following struct definitions, instance variables and methods.
struct RecType contains student id, first name, and last name.
struct NodeType contains student id, first name, last name, and a pointer to NodeType
hashPtr an instance variable pointing to hash table array of pointers
a constructor to input hash table size
void insert (RecType item)
will insert an item in the hash table.
item search (RecType item)
Will search an item in hash table and will return it. If not found will return an item containing -1 for id.
void startStatistics ();
void endStatistics ();
void displayStatistics();
Main Method
Provide main method that will create the hash table object and call its methods.
Hashing Algorithm
Calculate the hash index from student id as below:
hash index = (student id) % (total entries in hash table)
Statistics
Provide the following statistics
Total number if ids searched
Total number of nodes searched
Average number of nodes search per id searched
Testing
Use the data in file Add.txt for inserting in the table
Use the data in file Search.txt for doing searches in the hash table.
Add.txt
200
6929
6618
6741
1948
7601
2154
3286
3917
7909
6296
687
1620
8419
8606
3303
9873
6957
2587
8573
9686
Search.txt
50
2089
1376
8026
2791
3199
1390
4042
3624
6053
2252
237
6957
6791
6505
2695
3155
2083
1070
4372
3827
8395
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
