• edited by
9,722 views
29 29 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$

3 Answers

Best answer
31 31 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:
Position:
Show:

Related questions

62 62 votes
5 answers 5 answers
25.5k
25.5k views
Arjun asked Feb 12, 2020
25,509 views
Consider a double hashing scheme in which the primary hash function is $h_1(k)= k \text{ mod } 23$, and the secondary hash function is $h_2(k)=1+(k \text{ mod } 19)$. Ass...
40 40 votes
6 answers 6 answers
15.2k
15.2k views
Ishrat Jahan asked Nov 3, 2014
15,224 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)$...
34 34 votes
2 answers 2 answers
8.6k
8.6k views
Ishrat Jahan asked Nov 3, 2014
8,609 views
In the following table, the left column contains the names of standard graph algorithms and the right column contains the time complexities of the algorithms. Match each ...
45 45 votes
3 3 answers
10.6k
10.6k views
Ishrat Jahan asked Nov 3, 2014
10,608 views
Consider the context-free grammar$E \rightarrow E + E$$E \rightarrow (E * E)$$E \rightarrow id$where $E$ is the starting symbol, the set of terminals is $\{id, (,+,),*\...