CS140 -- Final Exam: December 7, 2004

Question 1 (15 points)

Multiple Choice: The following answers are for question 1. Please use the answer sheet provided.

For each action below, state the smallest of the functions above that characterizes the worst case running time of the action. In other words, if the action has a worst case running time of 4n+3, then the answer is c, not d or e.

Question 2 (10 points)

You are given the 32-element hash table pictured on the right.

Part 1

Suppose our hash function for a number n is
(n % 32). Suppose we are using linear probing to resolve collisions. Into which hash table location will the key 63 go?

Part 2

Suppose instead that quadratic probing is used. Into which hash table location will the key 63 go?