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 |
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 |