Question

Consider the following hashtable: index 0 1 2 3 4 5 6 7 8 element 81...

Consider the following hashtable:

index 0 1 2 3 4 5 6 7 8
element 81 10 63 14 42

It was created with the hash function H(x) = x % 9 and uses a quadratic collision scheme.

Which of the following was the order in which the elements were inserted to produce the table above?

a. All of the insert orders listed here will produce the hashtable shown above.

b. None of the insert orders listed here will produce the hashtable shown above.

c. The insert order: 10, 81, 14, 63, 42 will produce the hashtable shown above.

d. The insert order: 81, 10, 42, 14, 63 will produce the hashtable shown above.

e. The insert order: 14, 42, 10, 81, 63 will produce the hashtable shown above

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Option B is correct.

Since hash function is X%9 so the remainder would be the index for that X in the hash table.

Let's take any of the insert order :14,42,10,81,63

14 -> 14%9 = 5 (o.k.)
42 -> 42%9 = 6 (o.k.)
10 -> 10%9 =1 (o.k.)
81 -> 81%9 =0 (o.k.)
63 -> 63%9 =0 (collision occurs)

Here the collision has occurred.
To solve this either list chaining is applied(linked lis/list attached to each index to store elements wit collision)
but here no list has been mentioned.

Other method to overcome collision is "Linear Probing".
In this method When collision is occurred the next closest free(available) index is searched to insert the new element.
In this case 2(closer than 3 from 0) should be the index to insert 63.

So the actual insertion should be like this for any of the insert orders given here.

0 -> 81
1 -> 10
2 -> 63
3 ->
4 ->
5 -> 14
6 -> 42
7 ->
8 ->

Add a comment
Know the answer?
Add Answer to:
Consider the following hashtable: index 0 1 2 3 4 5 6 7 8 element 81...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 5. Hashing (a) Consider a hash table with separate chaining of size M = 5 and...

    5. Hashing (a) Consider a hash table with separate chaining of size M = 5 and the hash function h(x) = x mod 5. i. (1) Pick 8 random numbers in the range of 10 to 99 and write the numbers in the picked sequence. Marks will only be given for proper random numbers (e.g., 11, 12, 13, 14 ... or 10, 20, 30, 40, .. are not acceptable random sequences). ii. (2) Draw a sketch of the hash table...

  • 8 3 10 1 6 (14 4 7 13 For each of the following traversal orders,...

    8 3 10 1 6 (14 4 7 13 For each of the following traversal orders, list the order in which nodes in this tree will be visited. (a) Inorder (1) Preorder

  • Consider the product of two matrices A and B of dimensions 4 x 4 as shown below. 0 1 2 3 11 2 3 4...

    Consider the product of two matrices A and B of dimensions 4 x 4 as shown below. 0 1 2 3 11 2 3 4 | 0 1 2 3 I 1 0 2 46X2 3 4 5 I 0369 0 0 0 0 I I 14 20 26 32 I - 28 40 52 64 I I 42 60 78 96 I 3 456 1. Write a program to find the product of two matrices. The program should display...

  • The Fibonacci sequence is the sequence of numbers: 0, 1, 1, 2, 3, 5, 8, 13,...

    The Fibonacci sequence is the sequence of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, … The next number is found by adding up the two numbers before it. For example, the 2 is found by adding the two numbers before it (1+1). The 3 is found by adding the two numbers before it (1+2). The 5 is found by adding the two numbers before it (2+3), and so on! Each number in the sequence is called...

  • Data structures Exercises: For the following binary tree (Index-Value): 0 1 2 3 4 5 6...

    Data structures Exercises: For the following binary tree (Index-Value): 0 1 2 3 4 5 6 7 8 9 A C E G B P D X F H Give the pre-order traversal. Give the post-order traversal. Give the in-order traversal. Determine the height of the tree. Using these values: 8 6 4 3 5 9 2 1 6 Build a binary search tree. Build an AVL Tree. Build a 2-3 Tree. Build a min-heap. Build a max-heap. Apply a...

  • Accumulation Pattern Problem 2 Consider the code below. 1 2 3 4 5 6 7 8...

    Accumulation Pattern Problem 2 Consider the code below. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 labs = ['lab1', 'lab2', 'lab3', 'lab4', 'lab5', 'lab6', 'lab7', 'lab8', 'lab9'] graded = '' for lab in labs:     lab_num = int(lab[3])     if lab_num < 4:         graded = graded + lab + ' is simple\n'     elif lab_num < 7:         graded = graded + lab + ' is ok\n'     else:         graded = graded + lab + ' is complex\n'         ...

  • Number in Family 4 4 5 2 8 3 4 6 1 3 7 4 4...

    Number in Family 4 4 5 2 8 3 4 6 1 3 7 4 4 3 5 2 4 5 4 3 3 3 6 6 2 6 7 3 2 3 8 5 5 4 3 4 5 4 5 4 8 5 4 4 6 5 6 4 5 2 3 3 6 5 7 3 7 4 2 4 7 8 4 6 4 2 6 3 2 7 4 6 5 4 4 4 3...

  • 8 α = (д 1 9 2 5 3 4 5 10 3 6 7 86...

    8 α = (д 1 9 2 5 3 4 5 10 3 6 7 86 9 10 2 7 10) 1 4 1 в = (1, 2 3 3 5 4 8 5 2 6 9 7 7 8 4 9 6 10 1 10) 10 8 ү 1 3 2 7 3 9 4 5 1 5 6 7 8 2 9 4 19) 10 1 ө ( 42 2 4 5 4 6 5 2 6 7...

  • 2. 3. 4. 5. 6. 7. 8. A firm's average fixed cost (AFC) is 10 when...

    2. 3. 4. 5. 6. 7. 8. A firm's average fixed cost (AFC) is 10 when it produces Q=2. Then at Q=5, AFC is ... ОА. 8 Ов. 2 ос. 20 In a perfectly competitive market, the demand for a single firm's product is always O A. perfectly inelastic. O B. exactly as elastic as the market demand curve. O C. inelastic, but not perfectly inelastic. O D. perfectly elastic. As a firm's output increases: O A. average variable cost...

  • 1). The result of Java expression 5*7>3*(5+2) && 3*5-4<6 is ____ a. 35>35&&9<6 b. true &&...

    1). The result of Java expression 5*7>3*(5+2) && 3*5-4<6 is ____ a. 35>35&&9<6 b. true && false c. false d. False (2). You save text files containing Java language source code using the file extension___ a. .java b. .class c. .txt d. .src    (3). Which of the following is not a primitive data type in the Java programming language? a. boolean b. byte c. int d. Point (4). Given the Java statement int[][] vari = new int[5][7]; the value...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT