120k views
4 votes
How do you do this question?

How do you do this question?-example-1

1 Answer

0 votes

Answer:

int k=0;

for(int i=0;i<=13; i++)

{

if (table[i].getKey().equals(key))

{

k=i;

}

else

{

continue;

}

}

V value= table[k].getValue();

return value;

}

Step-by-step explanation:

Note table[i] is an entry, and we know the key as it is an argument input to the function. Hence, we find the entry position using the given key, and then find the corresponding value and return it. And this is what is required. There are 14 entries in this hashtable, as known from the question.

User Dark Daskin
by
5.7k points