CS 415, Section 002 Sonoma State University Spring, 2022
 
Algorithm Analysis
Instructor: Henry M. Walker

Lecturer, Sonoma State University
Professor Emeritus of Computer Science and Mathematics, Grinnell College

Lab:  Hashing

Instructions:

Hashing

A hash function returns integers between 0 and 15 based on the first letter of a data item according to the following table.

A B C D E F G H I J K L M
10 12 1 6 8 10 15 6 13 4 3 2 14
 
N O P Q R S T U V W X Y Z
6 0 8 1 7 10 2 14 4 11 8 5 15

For example, according to this hash function, the string TM would hash to the value 2 (based on the initial letter T; the hash function does not look at the second letter M).

  1. Consider the following sequence of 13 data items:

    UQ  GR  GD  WZ  QS  NW  DT  AX  SL  CY  EM  MR  ZB

    Suppose the above sequence is to construct each of the following data structures 16 locations (labeled 0 through 15), based on the hash function given above.

    1. Closed, unbucketed hash table, using linear probing
    2. Closed, unbucketed hash table, using quadratic probing (use both -i2 and +i2)
    3. Open, bucketed hash table (with chaining)

    Show the resulting structure by filling in the following tables:

    Closed, unbucketed hash table
    using linear probing
    Closed, unbucketed hash table
    using quadratic probing
    Open, bucketed hash table (with chaining)
    0     
    1     
    2     
    3     
    4     
    5     
    6     
    7     
    8     
    9     
    10     
    11     
    12     
    13     
    14     
    15     
    0     
    1     
    2     
    3     
    4     
    5     
    6     
    7     
    8     
    9     
    10     
    11     
    12     
    13     
    14     
    15     
    0  
    1  
    2  
    3  
    4  
    5  
    6  
    7  
    8  
    9  
    10  
    11  
    12  
    13  
    14  
    15  
created December, 2021
revised December-January 2021
Valid HTML 4.01! Valid CSS!
For more information, please contact Henry M. Walker at walker@cs.grinnell.edu.