Question

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);

0 0
Add a comment Improve this question Transcribed image text
Answer #1
a. set.add(5);

5
b. set.add(19);
5 19
c. set.add(31);
5 19 31

d. set.add(14);
14 5 19 31

e. set.add(44);
14 44 5 19 31
 
Add a comment
Know the answer?
Add Answer to:
java Assume that a hash set given the name set is initially empty, the set is...
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
  • 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.

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

  • 1. Given a hash table with size 10, hash function is hash(k) = k % 10,...

    1. Given a hash table with size 10, hash function is hash(k) = k % 10, and quadratic probing strategy is used to solve collisions. Please insert the keys 19, 68, 59, 20, 32, 88, 56 in the hash table. 2. Let T be a binary tree with 31 nodes, what is the smallest possible height of T? What is the largest possible height of T?

  • 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

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

  • You have a hash table of length 7 (tablesize 7). You are given a hash function...

    You have a hash table of length 7 (tablesize 7). You are given a hash function f(x)-x % tablesize, where x is the value to be hashed and fix) is the hash address. Quadratic probing is used to resolve the collisions. The hash function receives the input 40, 26, 15, 12, 5, 17) in that order. Place each number in hash table in its correct address. The first two values are already placed in their correct positions If there isn't...

  • 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

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

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

  • 0. Introduction. This involves designing a perfect hash function for a small set of strings. It...

    0. Introduction. This involves designing a perfect hash function for a small set of strings. It demonstrates that if the set of possible keys is small, then a perfect hash function need not be hard to design, or hard to understand. 1. Theory. A hash table is an array that associates keys with values. A hash function takes a key as its argument, and returns an index in the array. The object that appears at the index is the key’s...

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