Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

To answer my question, follow the instructionsare below in bulletpoints. Hash Co

ID: 3777380 • Letter: T

Question

To answer my question, follow the instructionsare below in bulletpoints.

Hash Collision Write code to insert an item AFTER a hash collision Pass the variable a key to the method liashFunction and assign the result to numslot Write a while loop that starts at slot index numslot of array hasharray and increments numslot until it finds an open slot Insert the variable akey into the array hasharray at the index slot found by the loop An index/slot is occupied when hasharray[index].charAt(0) != ' ' is true (that is a space '') An index/slot is open when hasharray[index].charAt(0) != ' ' is false (that is a space '') Do not declare or initialize any variables or write hashFunction, I will do that Implement the instructions above by placing your Code here:

Explanation / Answer

Edit: Please modify according to your needs, because doesn't clearly define parameter for function. I'm assuming you're passing array and numslot number to function as well.

As per your requirement, I think this will suffice

hashfunction(int akey, int numslot, int hashArray[]) {

// define

i = numslot;

while ((i+1)%size != numslot) {

     if(hasharray[i].charAt(0)=='') {

        hasharray[i] = akey;

        break;

     } else {

        i = (i+1)%size;

     }

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote