Question

Assume data is to be stored in a hash table using the following keys: 62,77.26, 42, 52,76 Assume the hash table size is 7, th
0 0
Add a comment Improve this question Transcribed image text
Answer #1
  • The given table size is 7, so the hash funtion will be h(key) = key%7
  • The inital hash table will be as follows:

0: _

1: _

2: _

3: _

4:_

5: _

6: _

  • Now , insert 62 into table. 62%7 = 6

0: _

1: _

2: _

3: _

4:_

5: _

6: 62

  • insert 77 into table, 77%7 = 0

0: 77

1: _

2: _

3: _

4:_

5: _

6: 62

  • Insert 26 into table, 26%7 = 3

0: 77

1: _

2: _

3:

4:_

5: 26

6: 62

  • Insert 42 into table, 42%7 = 0. It collides with 77, so store in next index 1

0: 77

1: 42

2: _

3:

4:_

5: 26

6: 62

  • insert 52 into table. 52%7 = 3

0: 77

1: 42

2: _

3: 52

4:_

5: 26

6: 62

  • insert 76 into table, 76%7 = 6. It collides with 62, so linearly probe until a free index is obtained. 0 is filled and 1 is filled too, so add the element ot index 2.

0: 77

1: 42

2: 76

3: 52

4:_

5: 26

6: 62

Answer: 77, 42, 76, 52, _, 26, 62

Add a comment
Know the answer?
Add Answer to:
Assume data is to be stored in a hash table using the following keys: 62,77.26, 42,...
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. Draw the hash table that results using the hash function: h(k)=kmod13 to hash the keys...

    5. Draw the hash table that results using the hash function: h(k)=kmod13 to hash the keys 18, 41, 22, 44, 59, 32, 31, 73. Assuming collisions are handled by Double hashing. ['M' is '7' which is less than the HTS and the hash function does not evaluate to '0'].

  • IN JAVA USING ECLIPSE The objective of this assignment is to create your own hash table...

    IN JAVA USING ECLIPSE The objective of this assignment is to create your own hash table class to hold employees and their ID numbers. You'll create an employee class to hold each person's key (id number) and value (name). Flow of the main program: Create an instance of your hash table class in your main method. Read in the Employees.txt file and store the names and ID numbers into Employee objects and store those in your hash table using the...

  • 13) consider the following sequence of keys to be inserted in a hash table of size...

    13) consider the following sequence of keys to be inserted in a hash table of size 13 that uses a quadratic probing to resolve collisions select the choice that indicateds what the hash table looks like after all the keys are inserted (0 indicates an empty slot) {23, 4, 78 , 17 , 30, 81, 41, 5} a) 78, 41, 0, 81, 4, 5, 17, 0, 30, 0, 23, 0, 0 b) 78, 17, 41, 81, 4, 5, 0, 30,...

  • Show how the following data would be stored in a hash table of size 7 (the...

    Show how the following data would be stored in a hash table of size 7 (the size is fixed) using quadratic probing. If any insertion fails, indicate that, but keep trying to insert all the remaining data. The hash function is hash(x) = x mod 7. Here is the data to be stored: 17, 10, 31, 45, 3, 53, 14. Insert the data in the order given. Data: Index: 0 1 2 3 4 5 6 4 data: Index: 31...

  • A hash table is a data structure that supports the storage of subset of keys from...

    A hash table is a data structure that supports the storage of subset of keys from a very large set S. To add a key x to a hash table, we use the hash function h: we compute h(x) and store x at location h(x). If two values x and y hash to the same location, we say we have a collision. For the hash table to work efficiently, we want to minimize the probability of collisions. The hash function...

  • Java using data structures The objective is to create your own Hash Table class to hold...

    Java using data structures The objective is to create your own Hash Table class to hold a list of employees and their ID numbers. I've provided the TableEntry class which will be each data object in the hash table. The list of employees will be provided as a .txt file and must be read with the code. please create a .txt file called Employees.txt with the info provided so that the java code can read it in. Employees.txt: (No WhiteSpace...

  • Need help on problems 3 and 4 only thanks in advance. Define the following terms: hash...

    Need help on problems 3 and 4 only thanks in advance. Define the following terms: hash table hash function perfect hash function What is a collision? Explain three ways of handling collisions (a program is not needed; a clear brief explanation suffices). Consider a hashing scheme that uses linear probing to resolve collisions. Design an algorithm (no code necessary) to delete an item from the hash table. What precautions do you need to take to make it work properly? Given...

  • Tree & Hash Table & Heap Use the following integer keys 73, 58, 91, 42, 60,...

    Tree & Hash Table & Heap Use the following integer keys 73, 58, 91, 42, 60, 130, 64, 87 to perform the followings: a) Binary Search Tree - Draw a binary search tree - Retrieve the integers keys in post-order - Retrieve the integers keys in pre-order - Draw a binary search tree after node 58 is deleted b) Create a Hash Table using the methods described below. Show the final array after all integer keys are inserted. Assumes that...

  • a. Suppose you are given the following set of keys to insert into a hash table...

    a. Suppose you are given the following set of keys to insert into a hash table that holds exactly 11 values: 113 , 117 , 97 , 100 , 114 , 123 , 116 , 98 , 99 using the hash function   h(item) = item%11 Fill in the following hash table Reference: URL in the Hash tables item 113 is provided since 113%11 = 3 0 1 2 3 4 5 6 7 8 9 10 Hash(item) 113 item b....

  • 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...

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
ADVERTISEMENT