This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: COMPSCI 342-001 Data Structure and Algorithms (Fall 2011) Lab Assignment #2, Due on 10/17/2011, Monday (11PM) • Introduction: Suppose we are inserting n keys into a hash table of size m . Then the load factor α is defined to be n/m . For open addressing n ≤ m , which implies that 0 ≤ α ≤ 1. In this assignment we will study how the load factor affects the average number of probes required by open addressing while using linear probing and double hashing. • Design: Set up the hash table to be an array of HashObject. A HashObject contains a generic object and a frequency count. The HashObject needs to implement Comparable inter- face, it should override the toString method and should also have a getKey method. Also we will use linear probing as well as double hashing. So design the HashTable class by passing in an indicator via constructor so that the appropriate kind of probing will be performed. Choose a value of the table size m to be a prime in the range [95500 . . . 96000]. A good value is to use a prime that is 2 away from another prime. That is, both m and m- 2 are primes. Vary the load factor α as 0.5, 0.6, 0.7, 0.8, 0.9, 0.95, 0.98, 0.99 by setting the value of n appropriately, that is, n = αm . Keep track of the average number of....
View Full Document
This document was uploaded on 11/01/2011 for the course COMPSCI 342 at Boise State.
- Fall '09