[go: up one dir, main page]

0% found this document useful (0 votes)
76 views2 pages

Worksheet 6 HashFunction

The document asks two questions about hashing techniques: 1) To draw a hash table using chaining for keys hashed with h(i) = (2k+5)mod 11. 2) To insert keys into a hash table using chaining, linear probing, and double hashing with m=11 entries and specified hash and step functions h1 and h2.

Uploaded by

Kashif Amjad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views2 pages

Worksheet 6 HashFunction

The document asks two questions about hashing techniques: 1) To draw a hash table using chaining for keys hashed with h(i) = (2k+5)mod 11. 2) To insert keys into a hash table using chaining, linear probing, and double hashing with m=11 entries and specified hash and step functions h1 and h2.

Uploaded by

Kashif Amjad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Question 1: Draw the 11-item hash table resulting from hashing the keys

12,44,13,88,23,94,11,39,20,16,5 using the hash function h(i) = (2k+5)mod 11 and handling


Collisions using chaining.
Question 2: Given a hash table with m=11 entries and the following hash function h1 and step
function h2:

h1(key) = key mod m


h2(key) = {key mod (m-1)} + 1
Insert the keys {22, 1, 13, 11, 24, 33, 18, 42, 31} in the given order (from left to right) to
the hash table using each of the following hash methods:

a. Chaining with h1  h(k) = h1(k)


b. Linear-Probing with h1  h(k,i) = (h1(k)+i) mod m

Double-Hashing with h1 as the hash function and h2 as the step function


 h(k,i) = (h1(k) + ih2(k)) mod m

You might also like