Description
Problem:
Write a C++ program that does the following :
1. Create an integer array of size 30. Assign * to each location in the array
indicating that the array is empty..
2. Populate half of the array with random integer values between 125 and 425
inclusive. Use the following formula in order to hash and store each number in its
proper position/location.
Generated Number % Table Size;
3. Should a collision occurs , use linear probing to find next available position /
location. Use the following probing hashing function.
( Generated Number + 1 ) % Table Size;
4. Display and introduction message followed by the generated array. The generated
array should be displayed in 2 lines. Each line contain 15 numbers separated by 2
spaces
The program then displays a menu on the screen allowing the user to do the following :
1. Display the generated array.
2. Search for a number ( between 125 – 425 ) in the array.
3. Insert new number ( between 125 – 425 ) in the array.
4. Delete a number ( between 125 – 425 ) from the array.
5. End the program
Spring 2018 – Husain Gholoom – Lecturer in Computer Science
Page 1CS3358 – -Data Structures
Programming Assignment 7
Upon program termination ; The program shall display the following statistical
information
• The number of linear probes when each number is hashed and collision
occurred when adding an element in the array.
• Include a signature line with your name – see sample run.
NOTES:
• Must use and modify the program that is provided in the my
Hashing lecture notes.
• Just one .cpp file.
• A Message is displayed when searching for a number and
number is not found.
• A Message is displayed when deleting a number and number is
not found.
• Modify the search and delete functions such that the functions
uses hashing and rehashing functions when searching and
deleting numbers form the table. You are not allowed to use
sequential search for locating and deleting number from the
tables.
• Validation on menu selection items.