Programming Assignment 5 for Hash Tables - Data Structures | CSCI 270, Assignments of Data Structures and Algorithms

Material Type: Assignment; Class: DATA STRUCTURES; Subject: Computer Science - CSCI; University: Texas A & M University-Commerce; Term: Fall 2004;

Typology: Assignments

Pre 2010

Uploaded on 08/18/2009

koofers-user-t1z
koofers-user-t1z 🇺🇸

9 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSCI 270 Program Assignment 5
Fall 2004 Due: Thursday, 9 Dec
Emphasis on: Hash Tables
Create a HashTable class that uses chaining to resolve collisions and random hshing for the hash
function. Your hash table class need only be designed to hold integer values. Implement the
basic operations for a hash table including constructors, destructors, insert and item and search
or retrieve an item.
Requirements
1) Your class must insert integer keys using random hashing. Use 9401 for the MULTIPLIER, 483
for the ADDEND and 2231 for the MODULUS
2) Separate chaining should be used to resolve collisions. You may want to use your LinkedList
class from assignment 4 as the basis of the linked list / chain that you create to resolve
collisions.
3) All basic operations given above should be supplied as public member functions of your
HashTable template class.
4) Provide a test driver where you demonstrate the use of your HashTable class.
Extra Credit
Use a template to allow your hash table to hash not just integer keys, but a new class you define
called HashItem. HashItem should include a function called getHashKey() that returns a hash
key to be used by your class. Inherit from HashItem to create IntHashItem and FloatHashItem
that hold an integer and float value and calculate an appropriate hash key to be used by your
template hash table.

Partial preview of the text

Download Programming Assignment 5 for Hash Tables - Data Structures | CSCI 270 and more Assignments Data Structures and Algorithms in PDF only on Docsity!

CSCI 270 Program Assignment 5

Fall 2004 Due: Thursday, 9 Dec

Emphasis on: Hash Tables

Create a HashTable class that uses chaining to resolve collisions and random hshing for the hash function. Your hash table class need only be designed to hold integer values. Implement the basic operations for a hash table including constructors, destructors, insert and item and search or retrieve an item.

Requirements

1) Your class must insert integer keys using random hashing. Use 9401 for the MULTIPLIER, 483

for the ADDEND and 2231 for the MODULUS

2) Separate chaining should be used to resolve collisions. You may want to use your LinkedList

class from assignment 4 as the basis of the linked list / chain that you create to resolve collisions.

3) All basic operations given above should be supplied as public member functions of your

HashTable template class.

4) Provide a test driver where you demonstrate the use of your HashTable class.

Extra Credit Use a template to allow your hash table to hash not just integer keys, but a new class you define called HashItem. HashItem should include a function called getHashKey() that returns a hash key to be used by your class. Inherit from HashItem to create IntHashItem and FloatHashItem that hold an integer and float value and calculate an appropriate hash key to be used by your template hash table.