CSE 2320 Section 060/061 Spring 1999

**Homework 3**

Due: March 25, 1999, in class (March 26, 1999, 5:00pm for -10%)

Due: March 25, 1999, in class (March 26, 1999, 5:00pm for -10%)

- 1.
- Show each of the final data structures described below after
inserting the keys 15, 35, 12, 13, 29, 2, 11, 24, 5 in this order.
- (a)
- Stack, using an array. Be sure to indicate the
*top*of the stack. - (b)
- Queue, using an array. Be sure to indicate the
*head*and*tail*of the queue. - (c)
- Singly-linked list. Be sure to indicate the
*head*of the list. - (d)
- Doubly-linked list. Be sure to indicate the
*head*of the list. - (e)
- Doubly-linked list with sentinel. Be sure to indicate the
*sentinel*of the list. - (f)
- A hash table with
*m*=13 slots using collision resolution by chaining and the division method hash function . - (g)
- A hash table with
*m*=13 slots using open addressing and the linear probing hash function , where . Show all computations of hash table indices, including collisions. - (h)
- A hash table with
*m*=13 slots using open addressing and the double hashing function , where and , . Show all computations of hash table indices, including collisions. - (i)
- Binary-search tree. Show the preorder, inorder and postorder
traversals of your tree.

- 2.
- Show that the number of different binary-search trees
*T*(*n*)containing*n*keys is exponential in*n*. Hint: derive a recurrence for*T*(*n*) and use the substitution method to show . Show all work.