The Gateway to Computer Science Excellence
0 votes

Following keys have to be inserted in exact order into the hash table with $9$ slots.

$5, 28, 19, 15, 20, 33, 12, 17, 10$

The auxiliary hash functions is $h(k)=K$ mod table size, where table size is $9$ . Which of the following represent the contents of the hash table in correct order after insertions are performed using linear probing?

  1. $12,28,19,20,10,5,15,33,17$
  2. $10,28,19,20,12,5,15,33,17$
  3. $33,28,19,20,12,5,15,10,17$
  4. $20,28,19,10,12,5,15,33,17$
in Programming by Veteran (75k points)
edited by | 43 views
why not D is correct plz explain?????
i changed previous question as i found that had insufficient data to answer, please check this new question.
is the ans B?

1 Answer

+1 vote
Best answer

B is the answer because in linear probing we linearly probe for the next slot. Indexes will be from 0 to 8 since, the hash function is K mod 9.

by (331 points)
selected by

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,405 answers
105,468 users