Insert the following IP addresses into a hash table of size 5 using universal hashing with a1 = 1, a2 = 2, a3 = 4 and a4 = 5.:
209.85.231.104 Google
207.46.170.123 Microsoft
208.80.152.2 Wikipedia
Ans.)Each IP address is a 32 bit, 4 tuple address as <x1,x2,x3,x4> where xi={0,.....,255}
therefore, hashing will be as:
ha=(x1,x2,x3,x4)= a1x1+a2x2+a3x3+a4x4
| Data | hashed value |
| 209.85.231.104 | 209 x 1+85 x 2+231 x 4+ 104 x 5=1823 |
| 207.46.170.123 | 207 x 1+ 46 x 2+170 x 4+123 x 5=1594 |
| 208.80.152.2 | 208 x 1+80 x 2+152 x 4+2 x 5=986 |
Insert the following IP addresses into a hash table of size 5 using universal hashing with...
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...
Insert the following keys into the following hash table, size 10: a. our hash function is simply key mod 10 b. Assume open hashing Keys: 566 909 212 655 123 444 974 321
10. Submission In this question you will work with a hash table that uses double hashing. The hash table is size 11, the primary hash function is h(K)-K mod 11, and the secondary hash function is hp(K)-(K mod9) +1 Take an empty hash table. Take your student number and split it into 4 2-digit integers. Insert each of these 2-digit numbers in the order in which they appear in your student number into the empty heap. Then insert the values...
Insert elements into a hash table implemented using chain hashing, as an array of linked list in which each entry slot is as a linked list of key/value pairings that have the same hash (outcome value computed using certain hash function). You are allowed to use “Hash Function”, h(k) = k % x where, x is the value you will need to decide to use, that you find appropriate for this implementation. The main requirements are the following: 1. Input:...
05. 6 points) Complete the following hash table using closed hashing with quadratic probing.M- 19. Follow the sequence of insertions, searches and deletions in the operations table, filling in the sequence of probes and whether the operation succeeded. Hash Table Index Value Operation Insert Insert 2 Insert 26 Insert 46 Insert 83 Search 45 Search 29 Delete 46 Insert 6 Insert 102 Search 8 Probe Success? (YIN) 10 15 16 17 18
05. 6 points) Complete the following hash table...
1. Using closed hashing with double hashing to resolve collisions insert the following keys into a table with 11 slots, numbered 0 through 10. The hash functions to be used are H1(k)k(mod11) and H2(k)- Rev(k + 1) (mod11) The function REV reverses the decimal digits like Rev(376) 673. Show the hash table after all nine keys have been inserted. Be sure to indicate how H1 and H2 are used. Keys: 4, 3, 2, 8, 33, 17, 24, 35, 46
4. Hashing and Hash Tables. You need to use the ASCII table in the last page for this question. Study the following hash functions for ASCII C strings that are at least 3-char long unsigned hash1(const char, unsigned unsigned vto]+01997 return (v % m); unsigned hash2Cconst char unsigned) unsigned v-o]k(2] 877 return 1 + (v % ( -1)); (a) Given that m-, 7, compute the hash values and fill the following table (3%) String k hash1k, ) hash2(k, 7) aph...
Part 5. Suppose that your hash function resolves collisions using the open addressing method with double hashing. The double hashing method uses two hash functions h and h'. Assume that the table size N = 13, h(k) = k mod 13, h'(k) = 1 + (k mod 11), and the current content of the hash table is: 0 1 2 3 6 7 8 9 10 11 12 4 17 5 98 If you insert k = 14 to this...
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...
10 points 10) Using Hopscotch hashing with a max hop of 4, hash the following keys. Table size is 15 A: 6 B: 7 c: 9 D: 7 E: 7 F: 6 G: 8