Math 167 - Advanced Data Structures
Homework #5
Due Friday, December 1, 2000.

Problem 1. A randomized skip list is built inserting the keys 1, 2, 3, ..., 10, where the level of the keys is given as in the following table.  Prof. Buss generated these values for the levels by using coin flips.  The levels are set equal to the number of times the coin was flipped until heads appeared (with a maximum level of 3).

 Key: 1 2 3 4 5 6 7 8 9 10 Level: 3 1 1 2 1 3 1 1 2 1
1. Draw a picture of the randomized skip list after all 10 keys have been inserted, in the style of the figures on pages 399-401 in Weiss.
2. What would happen differently if the keys were instead inserted in reverse order: 10, 9, 8, ..., 2, 1?  How would the resulting randomized skip list differ from your answer to part a.?

Problem 2. A treap is to be built containing the keys 1, 2, 3, ..., 10.  Prof. Buss generated the following priorities for these ten keys by repeatedly throwing a 20 sided die:

 Key: 1 2 3 4 5 6 7 8 9 10 Priority: 16 20 10 1 17 6 12 8 11 19
1. Draw a picture of the treap that results after keys 1, 2, 3, 4, and 5 are inserted.
2. Draw a picture of the treap that results after all the keys 1, 2, ..., 10 are inserted.
3. How would the treap be different if the keys were instead inserted in reverse order 10, 9, 8,  .., 2, 1.