Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java questions Q1.) Primary clustering occurs in A) linear probing B) quadratic

ID: 3806971 • Letter: J

Question

Java questions

Q1.) Primary clustering occurs in
A) linear probing
B) quadratic probing
C) separate chaining
D) all of the above

Q2.) Rehashing can be used in
A) linear probing
B) quadratic probing
C) separate chaining
D) all of the above

Q3.) Given the input {4371, 1323, 6173, 4199, 4344, 9679, 1989, 2525}, a fixed table size of 10, and a hsh function of H(X) = X % 10, show the result of inserting all of the elements using linear probing to resolve collisions. (Place null in the unused locations.)
Ans:
0 -------------------
1 -------------------
2 -------------------
3 -------------------
4 -------------------
5 -------------------
6 -------------------
7 -------------------
8 -------------------
9 -------------------

Q4) Given the input {4371, 1323, 6173, 4199, 4344, 9679, 1989, 2525}, a fixed table size of 10, and a hsh function of H(X) = X % 10, show the result of inserting all of the elements using quadratic probing to resolve collisions. (Place null in the unused locations.)
Ans:
0 -------------------
1 -------------------
2 -------------------
3 -------------------
4 -------------------
5 -------------------
6 -------------------
7 -------------------
8 -------------------
9 -------------------

Q5.) Given the input {4371, 1323, 6173, 4199, 4344, 9679, 1989, 2525}, a fixed table size of 10, and a hsh function of H(X) = X % 10, show the result of inserting all of the elementsusing separate chaining to resolve collisions.
(Place null in the unused locations. If multiple elements are in the same location, add to the front of the chain and separate elements with a comma and space. For example: 1234, 2234, 3334

Ans:
0 -------------------
1 -------------------
2 -------------------
3 -------------------
4 -------------------
5 -------------------
6 -------------------
7 -------------------
8 -------------------
9 -------------------

Explanation / Answer

1) Primary Clustering happens in Linear Probing. It happens when hash collision occurs and due to which more than one record in hash table ends up having same hash and effectively one of the records needs to move to next location in probe sequence.

2) Rehashing happens when number of elements in the map reached the threshold value and it can happen in all types of probing.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote