CS140 Final Exam: December 7, 2004


Question 3 -- 4 points

Multiple choice: What do you need to do to prove that a(r) = O(b(r))? Select just one of the following choices. Please use the answer sheet provided.

a. Show that there exist positive constants n and m such that for all values of r greater than r_0, m*a(r) > n*b(r).
b. Show that there exist positive constants n and m such that for all values of r less than r_0, m*b(r) > a(n).
c. Show that there exist positive constants n and m such that for all values of r less than n, m*b(r) > a(n).
d. Show that there exist positive constants n and m such that for all values of r less than n, m*a(r) > b(r).
e. Show that there exist positive constants n and m such that for all values of r greater than n, m*b(r) > a(r).
f. Show that there exist positive constants n and m such that for all values of r less than r_0, m*a(r) > b(n).
g. Show that there exist positive constants n and m such that for all values of r greater than r_0, m*a(r) > b(n).
h. Show that there exist positive constants n and m such that for all values of r less than r_0, m*b(r) > n*a(r).
i. Show that there exist positive constants n and m such that for all values of r greater than n, m*b(r) > a(n).
j. Show that there exist positive constants n and m such that for all values of r greater than n, m*a(r) > b(n).
k. Show that there exist positive constants n and m such that for all values of r less than n, m*b(r) > a(r).
l. Show that there exist positive constants n and m such that for all values of r less than r_0, m*a(r) > n*b(r).
n. Show that there exist positive constants n and m such that for all values of r greater than r_0, m*b(r) > n*a(r).
m. Show that there exist positive constants n and m such that for all values of r greater than r_0, m*b(r) > a(n).
o. Show that there exist positive constants n and m such that for all values of r less than n, m*a(r) > b(n).
p. Show that there exist positive constants n and m such that for all values of r greater than n, m*a(r) > b(r).


Question 4 -- 10 points

Suppose we are creating a splay tree with doubles as keys.

Part 1

Draw the splay tree that results when you insert the elements 1, 2, 3, 4, 5, 6, 7 and 8 in that order. Just show the final tree, not the intermediate trees.

Part 2

Now, insert 2.5 into the above tree, and show every step of splaying.