CS-240
Lab 12

Purpose:

Introduction to Hash Tables

Reading:

Nyhoff, Chapter 12, pp. 707-714

Due Date:

Bring written copy to next lab (either Tues. May 1 or Thurs. May 3)

Description:

Exercises 12.7, #1-4, on p. 714 of Nyhoff
  1. Using a hash table with eleven locations and the hashing function h(i) = i % 11, show the hash table that results when the following integers are inserted in the order given:  26, 42, 5, 44, 92, 59, 40, 36, 12, 60, 80.  Assume that collisions are resolved using linear probing.
  2. Repeat Exercise 1, but assume that collisions are resolved using quadratic probing.
  3. Repeat Exercise 1, but use double hashing to resolve collisions with the following secondary hash function:
              h2(x) = 2x % 11 if this is nonzero; 
                          1 otherwise
  4. Repeat Exercise 1, but assume that collisions are resolved using chaining.

Last updated 04/23/2007 - RMW