Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

void ComputedChaining::insert ( int key ) { int index = hash ( key ) ; if ( data _ vec [ index ] . data

void ComputedChaining::insert(int key){
int index=hash(key);
if(data_vec[index].data !=-1){//collision
if(isThisYourHome(data_vec[index].data)){//Q1: Add to chain
//Your code here
}else{//collision move foreigners
//store the key that will be moved(moved_key)
//find the chain of the moved_key
//find the index of moved_key in the chain
//store the previous index of the moved_key to change the link of the entry
//store the keys after moved_key in the chain
//assign -1 to indexes of data_vec where moved_key and remaining -1
//insert new key to its original address
//recursively insert remaining of the chain
}
}else{//direct insertion
data_vec[index].data = key;
data_vec[index].link=-1;
}
}
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

Students also viewed these Databases questions