Question
1. Consider the following hashing situation: The hash table is 1000 entries long. The search keys are integers between 0 and 9999. The hash function
1. Consider the following hashing situation: The hash table is 1000 entries long. The search keys are integers between 0 and 9999. The hash function is [h(key)=(keyrandom)%tablesize]
where random is a sophisticated (and efficient) random-number generator that returns a real value between 0 and 1.
Which is true of the hashing function (select all that apply)?
fast to compute |
utilizes a wide range of values between 0 and the size of the table |
minimizes collisions |
is repeatable |
2.Consider the following hashing situation:
The hash table is 10,007 entries long. The search keys are integers between 0 and 9999. The hash function is given by
const int TABLESIZE = 10007;
int Hash(int X)
{
for (int I = 1; I
X=X * X; // assume least significant digits are retained on overflow
return X % TABLESIZE;
}
Which is true of the hashing function (select all that apply)?
minimizes collisions |
utilizes a wide range of values between 0 and the size of the table |
fast to compute |
is repeatable |
3.
Consider the following hashing situation:
The hash table is 20,007 entries long. The search keys are strings less than 10 characters in length.
int TABLESIZE =20007;
int Hash(String s )
{
tot = 0;
for (int i = 1; i
tot += s[i];
return tot % TABLESIZE;
}
Which is true of the hashing function (select all that apply)?
minimizes collisions |
is repeatable |
fast to compute |
utilizes a wide range of values between 0 and the size of the table |
4.
Using a hash table with eleven locations and hashing function h(i) i%11, show the hash table that results when the following integers are inserted in the order given 26, 42,5,44,92,59,40,36,12 If a field is blank, mark as "empty Show the hash table using: a.Linear probing b. Quadratic probing c. Double hashing using the secondary hash function h-2-x89 + 1 to compute the personalized step. d. Chaining (show the chain as X->Y->Z..) Linear Probing Quadratic Probing Double Hashing Chaining 0 2 3 4 5 6 10Step 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