Computer Science 61B - Summer 1996 - Huang - Midterm 2

# Computer Science 61B - Summer 1996 - Huang - Midterm 2 - CS...

This preview shows pages 1–3. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CS 61Bc, Midterm #2, Summer 1996 Part C. (1 pt) Using the heap from Part B, show how the characters would be arranged in the array after removing the first two items from the heap. Question 2 [7 points total] Let's hash this out This problem contains three independent parts that all concern hash table. You should assume for this problem that there are no problems with arithmetic overflows. i.e., that the machine can handle arbitrarily large numerical values. Part A. (2 pts) Suppose that we implement a hash table using a character array of size 13 to store the keys themselves. Show the contents of the array when the keys S I L V E R M E D A L are inserted in that order into an empty hash table with linear probing to resolve conflicts. Use h(k) = k mod 13 as the hash function for the k th letter of the alphabet. (Note: S = 19th letter of alphabet, I = 9th, L = 12th, V = 2nd, E = 5th, R = 19th, M = 13th, E = 5th, D = 4th, A = 1st, L = 12th.) Circle those keys that encountered collisions when they were inserted into the table. Part B. (3 pts) Suppose you wish to make a hash table of all the computer science students at UC Berkeley using as the key each student's ID number, and suppose you have decided to implement the hash table using an unsigned long integer array of size 499, with quadratic probing to resolve conflicts. (by the way, both
This is the end of the preview. Sign up to access the rest of the document.

## This test prep was uploaded on 04/20/2008 for the course CS 61B taught by Professor Canny during the Spring '01 term at Berkeley.

### Page1 / 10

Computer Science 61B - Summer 1996 - Huang - Midterm 2 - CS...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online