Question

Insertthe following numbres into a initially empty hash table of size 10. The functions h(x) =...


Insertthe following numbres into a initially empty hash table of size 10. The functions h(x) = x % 10. Use linear probing when collision happens. Draw the hash tables and show the intermediate steps.
8,15,6,25,77,39
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Inserting 8
8 mod 10 = 8
8 is inserted at position 8

Number of cells visited during insertion is 1

Inserting 15
15 mod 10 = 5
15 is inserted at position 5

Number of cells visited during insertion is 1

Inserting 6
6 mod 10 = 6
6 is inserted at position 6

Number of cells visited during insertion is 1

Inserting 25
25 mod 10 = 5
There is already an item in 5
So, checking at index 6
There is already an item in 6
So, checking at index 7
25 is inserted at position 7

Number of cells visited during insertion is 3

Inserting 77
77 mod 10 = 7
There is already an item in 7
So, checking at index 8
There is already an item in 8
So, checking at index 9
77 is inserted at position 9

Number of cells visited during insertion is 3

Inserting 39
39 mod 10 = 9
There is already an item in 9
So, checking at index 0
39 is inserted at position 0

Number of cells visited during insertion is 2

HashTable
-----------
0   -      39
1   -
2   -
3   -
4   -
5   -      15
6   -      6
7   -      25
8   -      8
9   -      77


Add a comment
Know the answer?
Add Answer to:
Insertthe following numbres into a initially empty hash table of size 10. The functions h(x) =...
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
  • Use a hash table with a fixed size of 10. Don't grow the table or do...

    Use a hash table with a fixed size of 10. Don't grow the table or do any rehashing. Use the hash function H(x) = x % 10. Use Quadratic Probing to resolve collisions in part a, b and c: a)  Insert the items into an initially empty hash table. Draw the table that results. 71 23 73 99 44 b) Draw the table that results from adding 79 to the table in part a c) Draw the table that results from...

  • Insert these number into an initial empty table {371, 323, 173, 199, 344, 679, 989}, in...

    Insert these number into an initial empty table {371, 323, 173, 199, 344, 679, 989}, in this order, using hash function h(x)= x mod 7, show the resulting hash tables when using the each of following collision resolution strategies: Open hashing Linear probing

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

  • 6. A hash table has size 7, uses quadratic probing (f(i) = 1), and has hash...

    6. A hash table has size 7, uses quadratic probing (f(i) = 1), and has hash function h(2) = 2%7. (Recall, % is the Java "mod" function.) Draw the contents of the hash table after the following sequence of insertions: insert 0, insert 7, insert 14, insert 21. The hash table is initially empty.

  • Let 'M' denote the hash table size. Consider the following four different hash table implementations: a....

    Let 'M' denote the hash table size. Consider the following four different hash table implementations: a. Implementation (I) uses chaining, and the hash function is hash(x)x mod M. Assume that this implementation maintains a sorted list of the elements (from biggest to smallest) for each chain. b. Implementation (II) uses open addressing by Linear probing, and the hash function is ht(x) - (hash(x) + f(i)) mod M, where hash(x)x mod M, and f(i)- c. Implementation (III) uses open addressing by...

  • Given input {4371, 1323, 6173, 4199, 4344, 9679, 1989} and a hash function h(x) = x...

    Given input {4371, 1323, 6173, 4199, 4344, 9679, 1989} and a hash function h(x) = x (mod () 10), show the resulting: a. Separate chaining hash table b. Hash table using linear probing c. Hash table using quadratic probing d. Hash table with second hash function h2(x) = 7 - (x mod 7) *Assume the table size is 10.

  • ^b Given input( 66, 28, 43, 29, 44, 69, 19) and a hash function h(x) =...

    ^b Given input( 66, 28, 43, 29, 44, 69, 19) and a hash function h(x) = x mod 10, show the resulting hash table 1) Using Separate Chaining 2) Using Linear Probing 3) Using Quadratic Probing 4) Starting with the following hash function: h2(x) 7- (x mod 7), applv Rehash ary course slides ing as described in the prim Rehashing Increases the size of the hash table when load factor becomes "too high" (defined by a cutoff) - Anticipating that...

  • java Assume that a hash set given the name set is initially empty, the set is...

    java Assume that a hash set given the name set is initially empty, the set is implemented using an array of length 13, the hash function is h(x) = x % T (where T is the length of the array), and that quadratic probing is used if there are collisions. Show the state of the array after each operation: a. set.add(5); b. set.add(19); c. set.add(31); d. set.add(14); e. set.add(44);

  • C++ Question 13 Insert the values 15, 8, 10, 4, 2, 6,3,7,19,24, and 32 into an...

    C++ Question 13 Insert the values 15, 8, 10, 4, 2, 6,3,7,19,24, and 32 into an open addressing hash table of size 13 with hash function h(x) = x mod 13 and quadratic probing collision resolution. Show the steps taken to insert each number, including collision resolution, as well as the final table. It is not necessary to include all the intermediate tables, only the arithmetic used in insertions. B I VA-A-I EX5 11 xX, EE - ? Vx 12pt...

  • Given input { 66, 28, 43, 29, 44, 69, 19 } and a hash function h(x)...

    Given input { 66, 28, 43, 29, 44, 69, 19 } and a hash function h(x) = x mod 10, show the resulting hash table: 1) Using Separate Chaining 2) Using Linear Probing 3) Using Quadratic Probing

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