Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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.
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 NULLStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started