171k views
3 votes
3. (20 points) Suppose we wish to search a linked list of length n, where each element contains a key k along with a hash value h(k). Each key is a long character string. How might we take advantage of the hash values when searching the list for an element with a given key?

1 Answer

5 votes

Answer:

Alternatively we produce a complex (hash) value for key which mean that "to obtain a numerical value for every single string" that we are looking for. Then compare that values along the range of list, that turns out be numerical values so that comparison becomes faster.

Step-by-step explanation:

Every individual key is a big character so to compare every keys, it is required to conduct a quite time consuming string reference procedure at every node. Alternatively we produce a complex (hash) value for key which mean that "to obtain a numerical value for every single string" that we are looking for. Then compare that values along the range of list, that turns out be numerical values so that comparison becomes faster.

User Boris Silantev
by
5.4k points