Skip to main content
ICT
Lesson AB32 - Hash-Coded Data Storage
 
Main Previous
Title Page >  
Summary >  
Lesson A1 >  
Lesson A2 >  
Lesson A3 >  
Lesson A4 >  
Lesson A5 >  
Lesson A6 >  
Lesson A7 >  
Lesson A8 >  
Lesson A9 >  
Lesson A10 >  
Lesson A11 >  
Lesson A12 >  
Lesson A13 >  
Lesson A14 >  
Lesson A15 >  
Lesson A16 >  
Lesson A17 >  
Lesson A18 >  
Lesson A19 >  
Lesson A20 >  
Lesson A21 >  
Lesson A22 >  
Lesson AB23 >  
Lesson AB24 >  
Lesson AB25 >  
Lesson AB26 >  
Lesson AB27 >  
Lesson AB28 >  
Lesson AB29 >  
Lesson AB30 >  
Lesson AB31 >  
Lesson AB32 >  
Lesson AB33 >  
Vocabulary >  
 

LAB ASSIGNMENT AB32.1 page 8 of 8

Hashing

Background:

A larger version of the store inventory data file (file400.txt) will be used in this lab assignment. As you may recall, the text file consisted of two fields, id and inv. The id values range from 1-20000 and the inv fields from 1-100. There are no duplicate id values in the data file. Every id value is unique in the file and the number of store items in this problem is 400. Use this value to size your hash table.

Assignment:

  1. Write a program that uses a hash-coded data storage method to store the 400 items from file400.txt.

  2. The method of dealing with collisions should be the dynamic linked list.

  3. You should develop your own hashing scheme to take the key field (id) and determine the location to look for the item.

  4. Test your new data structure and algorithm with some sample searches. The program should prompt you for an id value and return the inv amount or a message that the id does not exist. Your teacher will specify some sample id values to test out.

  5. Your program must analyze the efficiency of your hashing scheme by determining the following statistics about your hash table:

    1. the % of null pointers in the hash table
    2. the average length of linked lists
    3. the longest linked list in the hash table

    After seeing these results, you might want to try to improve upon your hashing scheme if the number of collisions is excessive.

Instructions:

  1. Turn in your source code and a run output of the following results:

    1. the searches

    2. the statistical analysis of the hash table

 

Main Previous
Contact
 © ICT 2006, All Rights Reserved.