CSE 2320 Section 501 Fall 1998

Homework 3

Due: October 27, 1998, in class (October 28, 1998, 5:00pm for -10%)

1.
Show the final hash tables described below after inserting the keys 4, 18, 13, 51, 11, 24, 1, 15, 26 in this order. Show all computations of hash table indices, including collisions.

(a)
A hash table with m=13 slots using collision resolution by chaining and the division method hash function .

(b)
A hash table with m=13 slots using open addressing and the linear probing hash function , where .

(c)
A hash table with m=13 slots using open addressing and the quadratic probing hash function , where .

(d)
A hash table with m=13 slots using open addressing and the double hashing function , where and .

(e)
Compare the number of collisions made by each hash function above.

(f)
Does the quadratic probing hash function of part c make full use of the hash table? Justify your answer.

2.
Show the binary search tree whose postorder traversal is 1, 2, 3, 4, 6, 10, 9, 8, 7, 5. Also, show the preorder traversal of the tree.

3.
Show the Red-Black trees that result after each successive insertion of the keys 3, 7, 12, 9, 1, 15, 8, 5, 13, 4 (in this order) into an initially empty Red-Black tree.

4.
Show the Red-Black trees that result after each successive deletion of the keys 7, 6, 1, 10, 9, 12, 2, 11, 5, 4, 3, 8 (in this order) from the following Red-Black tree.

5.
Show the B-trees that result after each successive insertion of the keys X, K, N, R, U, V, Y, C, D, J, S, Z, G, H, A, M, E, B, L, F, I, T (in this order) into an initially empty B-tree with minimum degree t = 3.

6.
Show the B-trees that result after each successive deletion of the keys 13, 19, 16, 4, 2, 22, 1, 14, 20, 17, 8, 21, 11 (in this order) from the following B-tree with minimum degree t = 2. When you have a choice between a left or right sibling, always choose the left sibling. Always try Case 2a (predecessor) before Case 2b (successor).