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
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.
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:...
Consider total cost and total revenue given in the following table: Quantity 0 1 2 3...
Consider total cost and total revenue given in the following table: Quantity 0 1 2 3 4 5 6 7 Total cost $8 9 10 11 13 19 27 37 Total revenue $0 8 16 24 32 40 48 56 a. Calculate profit for each quantity. How much should the firm produce to maximize profit? b. Calculate marginal revenue and marginal cost for each quantity. Graph them. (Hint: Put the points between whole numbers. For example, the marginal cost between...
Plant sizes get larger as you move from ATC-1 to ATC-4. Output ATC-1 ATC-2 ATC-3 ATC-4...
Plant sizes get larger as you move from ATC-1 to ATC-4. Output ATC-1 ATC-2 ATC-3 ATC-4 1,500 $10 15 $20 $30 2,000 8 12 17 25 2,500 9 10 15 20 3,000 12 8 13 18 3,500 15 6 11 16 4,000 18 10 9 14 4,500 20 12 7 12 5,000 24 15 11 10 5,500 29 19 13 8 6,000 35 25 15 9 Which plant size would produce at the least cost for the 1,500-2,500 range of...