Question: Write the code in C++ and show the snapshot of output. Your task is to build a hash table and use singly linked list to

Write the code in C++ and show the snapshot of output.

Write the code in C++ and show the snapshot of output. Your

Your task is to build a hash table and use singly linked list to address collisions. The objects that your list must hold are stocks consisting of a String 'Name', unsigned int 'Code', and int 'Price', and of course an object array (Hint: it would be helpful if your array is type node *inventory[MAX SIZE]; Where node is an object which holds a Stock and a Node" next.) From your main program insert 500 stocks into your table, which can hold 2000 stocks, by creating a hash function that will return your the index where the stock was inserted. Your hash function should reduce collisions as much as possible; however, if you do encounter a collision use singly linked lists to address it. Finally write a short function that analyses your collision rate (you can accomplish this by dividing the total number of stocks by the spaces filled in the table ABC 0001 13.25 LNV 0001 5025 NULL CYS 0002 1005 NULL CTX 1997 89.2 1997 1998 NULL

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!