CS307 Fall 2009 Final Exam
Suggested Solution and Criteria:
1 1.5 Each
A:
72
/
\
6
125
\
\
51
218
/
41
B: 12, 9, 0, -5, 25, 20, 30
C: -5, 0, 9, 25, 12, 20, 30
D: -5, 0, 25, 9, 30, 20, 12
E: No.
F: valid binary search tree using values between 1 and 10. No repeats.
G: The path rule is violated OR paths with different numbers of black nodes (1, 2,
3)
Or words to that effect.
H: Yes. (Explanation not required, but make 200 black, 400 red, and 70 red and
magic number is now 2.
I: O(N) okay if just N
J: O(N^2) okay if N^2
K: Yes, it goes through all of the values in the list using an iterator instead of
the get method. (Or words to that effect.)
L: O(NlogN) okay if just NlogN or base 2 included
M: (3 + 2) * (5 + 2)
N: 14 15 1 15 13
O: z s p r s
P: Variables must have
a box and arrow.
Q: 7 bits or just 7
R: Any value between 13 and 25. (10 not okay. That would be best case height which
is not likely.)
S: add at front, remove from front, or add at end.
T: E can be thought of as a variable that stores the data that a particular