CS 301 - Data Structures and Algorithms I - Fall 2002
Homework 7


Loyola College > Department of Computer Science > CS 301 > Homework > Homework 7

Due

Not to hand in. Solutions will be posted.

Problem 1: Suppose the following keys are to be stored in a hash table. ripken, murray, palmer, weaver, robinson, thompson. Let the hash function be ((value(key[0]) + value(key[key.length - 1]) * key.length) % tableSize where key.length gives the length of a key, key[i] gives the character at the ith position of a key, and value(ch) returns the numeric value of the given letter (a = 1, b = 2, etc).

Problem 2: Consider the following ASCII art heap.

                            3
                    /               \
            5                               10
        /       \                       /       \
    8               6               15              12
  /   \           /   \           /    \          / 
9       14      7       13      20       16     19