Question

You are given a hash table which uses separate chaining. The table has a size of...

You are given a hash table which uses separate chaining. The table has a size of 10.

The hash function being used is h(x) = x.

You insert 6, 13, and 201 into the hash table. If you then insert(3) into the hash table, it will be put at which index?

You insert 9, 19, and 29 into the hash table. What is the size of the bucket at index 9?

Homework Answers

Answer #1

Ans).
Hash function is h(x)= x and table size is 10.
when we insert 6, it'll ho at 6%10 = 6 index.

13 goes at 13%10=3 index

201 goes at 201%10=1 index.

Now when we insert 3, it'll go to 3%10=3 index.

Since 13 is already there, and are using chaining technique, we'll append 3 at the linked list at index 3.

so now, index 3 consists of a list containing 13 and 3.

when we put 9,19 and 29, all of them have same hash value and thus index which is 9. So all three will go to the bucket/list at index 9.

Therefore at index 9, bucket size is three.

Hope it helped! Feel free to ask any doubt in comments. Don't forget to upvote if it helped :).

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Q2.1 Chaining Insert 17,44,74,88 , in order, into an empty hash table of size 5 with...
Q2.1 Chaining Insert 17,44,74,88 , in order, into an empty hash table of size 5 with chaining, using hash function h(x)=x mod 5 Write/draw the resulting table Q2.2 Open addressing with linear probing Insert the same numbers in the same order into an open-addressing initially empty table using linear probing, with the same hash function h(x)=x mod 5. Draw/write down the resulting table
Assume that n items are mapped to a hash table of size m (separate chaining) by...
Assume that n items are mapped to a hash table of size m (separate chaining) by simple uniform hashing. a. What is the probability that a given row of the hash table has at least 2 items? b. What is the probability that some row of the hash table has at least 2 items?
Question 7 Consider the hash function where m=10 is the size of the table. Insert the...
Question 7 Consider the hash function where m=10 is the size of the table. Insert the keys 89, 18, 49, 58 and 9 in a hash table using Linear probing Quadratic probing with and
3.2 Class Dictionary This class implements a dictionary using a hash table in which collisions are...
3.2 Class Dictionary This class implements a dictionary using a hash table in which collisions are resolved using separate chaining. The hash table will store objects of the class Data. You will decide on the size of the table, keeping in mind that the size of the table must be a prime number. A table of size between 5000-10000, should work well. You must design your hash function so that it produces few collisions. A bad hash function that induces...
1) Suppose that you have table size M=101 and you are using double hashing. The first...
1) Suppose that you have table size M=101 and you are using double hashing. The first hash function h1, is used to determine the home position, and the second hash , h2, is used to determine the increment for linear probing. Suppose you have two records with keys k1, and k2, such that: h1(k1) = 5, h2(k1)= 3, h1(k2) = 5, h2(k2) = 11. Note: h2 is returning an offset, not an index. Fill in the Blank : The First...
Suppose you are building a hash table and want the probability of collision in your has...
Suppose you are building a hash table and want the probability of collision in your has function to be less than 10-6. The output of your hash function is a sequence of bits (e.g., 1001010111 is a sequence of 10 bits). What is the minimum number of bits needed for the hash function output to achieve the desired probability of collision. You may use the approximation 103 = 210 to simplify your math if you wish.
1.Consider a hard drive with an average seek time of 9 ms. Its disk spins at...
1.Consider a hard drive with an average seek time of 9 ms. Its disk spins at 7200 rpm. What’s the average access time? In your answer, ignore the drive transfer time and any controller overhead. 2.Suppose that we are using extendable hashing on a file that contains records with the following search-key values: (2, 3, 5, 7, 11, 17, 19, 23, 29, 31). Show the final extendable hash structure for this file if the hash function is h(x) = x...
You have been given the expected return data shown in the first table on three assets—F,...
You have been given the expected return data shown in the first table on three assets—F, G, and H—over the period 2015-2018 Year Asset F Asset G Asset H 2015 9 12 15 2016 8 9 16 2017 5 21 19 2018 13 6 11 a. Find the expected return, variance, std dev and coefficient of variation for each asset. b.  Now consider a portfolio that consists of 25% of F, 50% of G and 25% of H. Find the expected...
You have been given the expected return data shown in the first table on three assets—F,...
You have been given the expected return data shown in the first table on three assets—F, G, and H—over the period 2016-2019 Year Asset F Asset G Asset H 2016 7 10 15 2017 6 8 16 2018 3 19 19 2019 11 9 11 Using these assets, you have isolated the three investment alternatives shown in the following table. Alternative Investment 1 100% of asset F 2 75% of asset F and 25% of asset G 3 50% of...
13. (True/False): The register list in the USES directive must use commas to separate the register...
13. (True/False): The register list in the USES directive must use commas to separate the register names. 11. (True/False): The USES operator lets you name all registers that are modified within a procedure. 2. Which instruction pushes the 32-bit EFLAGS register on the stack? 18. Which statement is true about what will happen when the example code runs? 1: main PROC 2: mov eax,40 3: push offset Here 4: jmp Ex4Sub 5: Here: 6: mov eax,30 7: INVOKE ExitProcess,0 8:...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT