Question
JAVA Homework Q1.) What is the range of values computed by the hash function hash(x)= x % 100? A) 0 to 99 B) 0 to
JAVA Homework
Q1.) What is the range of values computed by the hash function hash(x)= x % 100?
A) 0 to 99
B) 0 to 100
C) 1 to 99
D) 1 to 100
Q2.) How are elements deleted in linear probing in the implementation discussed in the Weiss textbook?
A) the element referenced in that location is set to null.
B) the HashEntry referenced is made null
C) they are changed to zero
D) they are marked "deleted" or "available"
Q3.) Suppose we are implementing quadratic probing with a hash function hash(x) = x mod 100. If an element with key 4592 is inserted and the first four locations attempted are already occupied, then the next index location that will be tried is
A) 8
B) 1
C) 9
D) 95
Q4.) Linked lists are used in
A) double hashing
B) linear probing
C) quadratic probing
D) separate chaining
Q5.) Primary clustering occurs in
A) linear probing
B) quadratic probing
C) separate chaining
D) all of the above
Q 6.) Rehashing can be used in
A) linear probing
B) quadratic probing
C) separate chaining
D) all of the above
Q7.) 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 -------------------
Q8) 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 -------------------
Q9.) 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 -------------------
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started