CS 415, Section 002 | Sonoma State University | Spring, 2022 |
Algorithm Analysis
|
||
Instructor: Henry M. Walker
Lecturer, Sonoma State University |
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).
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.
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) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
created December, 2021 revised December-January 2021 |
|
For more information, please contact Henry M. Walker at walker@cs.grinnell.edu. |