Problem 4 (40):
Create struct HashNode and class HashTable that will be used to store students' data. For each student, it'll store the ID (string) as the key, and the first name (string), last name (string), and email (string) as the value. You can imagine a single HashNode as follows:
"900123456"
"Ali" "Ahmed" "someone@aucegypt.edu"
HashTable should have the following attributes and methods:
Attributes:
1. The dynamic array that stores the data
2. The number of elements currently stored
3. The maximum number of elements the container can store.
Methods:
1. Constructor that takes from the user the maximum size of the container
2. bool insert(string ID, string firstName, string lastName, string email): uses the following hash function h2(h1(ID)) to map the key to a specific index in the table: h1(ID) = IDLength-1 ID, h2(K) -> [0, N-1], where N is the table size. Returns false if the student's data couldn't be inserted, and returns true if the index was empty and the student's data was successfully inserted.
Bonus (20):
3. bool updateEmail(string ID, string newEmail): updates the email of a specific student if his/her ID was found and returns true. If the ID wasn't found, it returns false.
4. Overload the [] operator to retrieve all data of the student with the given ID.