Question

You are given a hash function f1(x) = x % 5, where x is the value to be hashed and f(x) is the hash address. Double hashing is used to resolve collisions, f2(x)-1 + x%3. An ith probe collision is resolved by ( f(x) + i*f2(x) )965 The hash function receives the input (7, 6, 4, 12,10 in that order. Place each number in the hash table at its correct address. Address 0 1 234

0 0
Add a comment Improve this question Transcribed image text
Answer #1
7   ->  7 % 5 is 2. so, insert 7 at position 2
6   ->  6 % 5 is 1. so, insert 6 at position 1
4   ->  4 % 5 is 4. so, insert 4 at position 4
12  ->  12 % 5 is 2.
        there is already a value at position 2
        so, use second hash function.
        f2(x) = 1 + 12%3 = 1 + 0 = 1
        (f1(x) + 1*f2(x)) % 5 = (2 + 1) % 5 = 3
        so, insert 12 at index 3
10  ->  10 % 5 is 0. so, insert 10 at position 0

Address     value
-------------------
0           10
1           6
2           7
3           12
4           4
Add a comment
Know the answer?
Add Answer to:
You are given a hash function f1(x) = x % 5, where x is the value...
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
  • C++ Problem: Please explain the process! You are given a hash function fl(x) : x %...

    C++ Problem: Please explain the process! You are given a hash function fl(x) : x % 5, where x is the value to be hashed and h(x) is the hash address. Double hashing is used to resolve collisions and f2(x)-1 + x 96 4. If you get a collision at ith probe collision is resolved by ( f1(x) + if2(x) )96 5 The hash function receives the input [5, 10, 30, 32, 34 in that order. Place each number in...

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

  • 11. Dra The size The hash function used is: the contents of the 13 hash tables...

    11. Dra The size The hash function used is: the contents of the 13 hash tables below. Show your work for partial r hash table is HOk)-k mod 7 13, 17, 6, 24, 3 a) Resolve collisions with chaining b) Double hashing, where W20)-7-0mod 5) 0 1 1 2 2 3 3 4 4 5 5 6 6 c) What is the load factor for the table a? d) What is the load factor for the table b? f) Is...

  • 3. Given input (89, 18, 49, 58, 69), h)k(mod 10) g) Iymod 8), and a hash function f(k) h(k) +j-g(...

    3. Given input (89, 18, 49, 58, 69), h)k(mod 10) g) Iymod 8), and a hash function f(k) h(k) +j-g(k) (mod 10), show the resulting hash table. Solve collisions with double hashing. 3. Given input (89, 18, 49, 58, 69), h)k(mod 10) g) Iymod 8), and a hash function f(k) h(k) +j-g(k) (mod 10), show the resulting hash table. Solve collisions with double hashing.

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

  • Name: Hash Tables CS 2020 Hw 14 edefine MAX CAPACITY 11 #define R struct HashTable f...

    Name: Hash Tables CS 2020 Hw 14 edefine MAX CAPACITY 11 #define R struct HashTable f int hashtable[MAX CAPACITY]: 1/ table to store values int countj // count of values currently stored int hash1(int value) ( return (value % MAX CAPACITY); int hash2(int value) ( return (R- (value % R)); 1) Use hash1 function and linear probing as a collision resolution strategy, insert the following elements into the correct index of the hash table: 1, 5, 4, 11, 21, 15,...

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

  • (6 points) The continuous random variable X has cumulative distribution function given by 0 for x...

    (6 points) The continuous random variable X has cumulative distribution function given by 0 for x <0 for x > 2 Part(a) Find the value of c correct to one decimal place given that E(X c) 4E(X - c). 0.4 Part(b) Two independent observations of X are taken. Find the probability correct to 2 decimal places that one is less than 1 and the other is greater than 1. The order in which we take the observations matters. Part(c) Find...

  • How to write the insert, search, and remove functions for this hash table program? I'm stuck......

    How to write the insert, search, and remove functions for this hash table program? I'm stuck... This program is written in C++ Hash Tables Hash Table Header File Copy and paste the following code into a header file named HashTable.h Please do not alter this file in any way or you may not receive credit for this lab For this lab, you will implement each of the hash table functions whose prototypes are in HashTable.h. Write these functions in a...

  • need help solving and checking answers Evaluate each function for the given value of x, and...

    need help solving and checking answers Evaluate each function for the given value of x, and write the input and output as an ordered pair. Need help? Check out these resources: http://virtualnerd.com/algebra 1/linear-equation-analysis/point- slope-standard-form/standard-form-examples/write-linear- equation standard-form-slope-point 27. f(x) = 3x - 7 for x = 6 28.g(x) = 9x - 5 for x = 3 29.h(x) = 12x for x = 4 30.t(x) = 8x - 5 for x = 7 Linear Functions and Slope Intercept Form You can use...

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