Now that you have a working implementation of the HashNode and HashTable classes, you can convert them to templates, and update main.cpp to match with the new template classes.
In order for everything to work you will also have to:
- overload the == operator for the Student class
- declare the hash function a friend function of the Student class
- send the hash function as an argument to insert, remove, and search functions.
Reuse code from the previous lab and write new code as described below:
- search hash: Modify this function to return -1 if the target key is not found or the number of collisions for that key if found.
`int search(Student &target, string key);`
- remove hash: Create a new function to delete an item from the hash table.
- insert manager: inserts user provided data into the hash table and rejects duplicates.
Hash Function: Add the ASCII values of all characters in the key string and return the reminder obtained when divided by the size of the table.
Example: If key = "Bob", and size = 53, we get (66 + 111 + 98) % 53 => 275 % 53 => 10.
Collision Resolution Method: Linear Probe.
The assignment consists of the following classes/files:
- main.cpp (incomplete)
- Student.h (given)
- HashNode.h (given)
- HashTable.h (given)
- HashTable.cpp (incomplete)
Read and understand the given code then write two functions:
- insert hash
- search hash
- Modify the Park class from previous assignments.
- Rewrite the private insert as a recursive function.
- Write the buildBST() function (similar to buildList() in the doubly-linked list lab).
- Display the number of nodes in the tree as shown below:
- Display the tree in inorder, preorder or postorder
- Display the tree as an indented list
- Display the inner nodes of the BST (including its root), in alphabetical order by code
- Write the searchManager() function (similar to searchManager() in the doubly-linked list lab). It calls search BST in a loop.
- Search the BST (implement the recursive private search function).
Implement the pair of search functions for searching the BST:
- _search - recursive (private function)
- search - wrapper for _search (public function)