Given the elements {4371, 1323, 6173, 4199, 4344, 9679, 1989}, a fixed hash table size of 10, and the hash function \(\texttt{H(X) = X mod 10}\), show for each of the following collision resolution techniques, the final hash table after inserting each of the above elements.

  • using Linear probing;
  • using Quadratic probing;
  • using Separate chaining (insertion at the end of each linked list).
     

Difficulty level
Video recording
This exercise is mostly suitable for students
1* Linear probing
Element:	9679	4371	1989	1323	6173	4344				4199
i:		0	1	2	3	4	5	6	7	8	9

2* Quadratic probing
Element:	9679	4371		1323	6173	4344			1989	4199
i:		0	1	2	3	4	5	6	7	8	9

3* Separate chaining
i:	0	1	2	3	4	5	6	7	8	9
		|		|	|					|
		4371		1323	4344					4199
				|						|
				6173						9679
										|
										1989

Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Target sum in a BST