| CS 261 | University of Puget Sound | Spring, 2020 |
|
Computer Science II
|
||
|
Abstract Data Types and their Implementations,
Some Basic Algorithms,
Object-oriented Problem Solving, and Efficiency |
||
Warning:
This course is under development.
Although the basic structure of this course is largely established,
nothing on this Web site should be considered official or even possibly
correct.
DO NOT MAKE PLANS BASED ON THE CONTENTS OF THIS SITE UNTIL JANUARY, 2020.
This lab provides practice with several basic algorithms related to hash tables.
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 | 7 | 12 | 1 | 3 | 5 | 10 | 1 | 8 | 15 | 14 | 13 | 9 |
| N | O | P | Q | R | S | T | U | V | W | X | Y | Z |
| 6 | 11 | 3 | 12 | 2 | 5 | 13 | 9 | 15 | 6 | 3 | 0 | 7 |
For example, according to this hash function, the string TM would hash to the value 13 (based on the initial letter T; the hash function does not look at the second letter M).
Consider the following sequence of 11 data items:
MQ GR GD WZ QS HW DT AX AL CY EM
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 30 April by Henry M. Walker revised 7 May 2012 by Henry M. Walker very minor editing 31 January 2020 by Henry M. Walker |
|
| For more information, please contact Henry M. Walker at walker@cs.grinnell.edu. |