edited by
6,572 views
22 votes
22 votes

A hash table contains $10$ buckets and uses linear probing to resolve collisions. The key values are integers and the hash function used is $\text{key}\%10$. If the values $43, 165, 62, 123, 142$ are inserted in the table, in what location would the key value $142$ be inserted?

  1. $2$
  2. $3$
  3. $4$
  4. $6$
edited by

3 Answers

Best answer
25 votes
25 votes

$43$ in loc $3$

$165$ in loc $5$

$62$ in loc $2$

$123$ in loc $4$ ( collission and next free space)

$142$ in loc $6$ (collision in $2$, and $3,4,5$ already occupied)

hence answer D

edited by
Answer:

Related questions

30 votes
30 votes
5 answers
1
Ishrat Jahan asked Nov 3, 2014
9,234 views
Let $T(n)$ be a function defined by the recurrence$T(n) = 2T(n/2) + \sqrt n$ for $n \geq 2$ and$T(1) = 1$Which of the following statements is TRUE?$T(n) = \Theta(\log n)$...
22 votes
22 votes
2 answers
2