Вопрос

To prevent collisions in Hash table , seperate chaining with linked list is used . Hash table works by hashing the key and storing the value in the bucket.

Assuming 4 keys hash to the same bucket , and the bucket has a linked list which has 4 nodes , how would we know which value belong to the key when we try to search for the value of the key .

For eg : These 4 key-value :a:4 , b:3 , c:2 , d:1 , hash to bucket 23. At bucket 23 , there is a linked list of values : 4 , 3 , 2 , 1 , how would we know which values belong to which key

Нет правильного решения

Лицензировано под: CC-BY-SA с атрибуция
Не связан с cs.stackexchange
scroll top