Question: void ComputedChaining::insert ( int key ) { int index = hash ( key ) ; if ( data _ vec [ index ] . data
void ComputedChaining::insertint key
int indexhashkey;
ifdatavecindexdata collision
ifisThisYourHomedatavecindexdataQ: Add to chain
Your code here
elsecollision move foreigners
store the key that will be movedmovedkey
find the chain of the movedkey
find the index of movedkey in the chain
store the previous index of the movedkey to change the link of the entry
store the keys after movedkey in the chain
assign to indexes of datavec where movedkey and remaining
insert new key to its original address
recursively insert remaining of the chain
elsedirect insertion
datavecindexdata key;
datavecindexlink;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
