| CIT594 Final Exam Spring 2009 |
Name_________________________________________ |
Please keep all your answers short and to the point. Do not provide extra information that was not asked for.
IntList has public instance variables
int value and IntList next, with the
obvious meanings. Write a recursive method int size
to count the number of values in the IntList list. int size()
method described in the previous question.int myArray[][] = new int[3][8],
what value is in myArray[1]?
for (int i = 0; i < a.length; i++) a[i] = i * i;
for (int i = 0; i < 10000; i++) a[i] = i * i;
Stack class extends the
Vector class. Why does your instructor think this is a
bad design?
|
![]() |
int max1(int[] nums, int last) {
if (last == 0) return nums[0];
else {
if (nums[last] > max1(nums, last - 1)) {
return nums[last];
} else {
return max1(nums, last - 1);
}
}
} |
int max2(int[] nums, int last) {
if (last == 0) return nums[0];
else {
int temp = max2(nums, last - 1);
if (nums[last] > temp) {
return nums[last];
} else {
return temp;
}
}
} |
|
A + F = 6 (v) B + v = 18 (w) w + E = 35 (x) C + D = 65 (y) x + y = 100 (z) |
|
| A = 0010 | B = 000 | C = 10 | D = 11 | E = 01 | F = 0011 |
f(N) = g(N) + h(N), what
do each of the following stand for?Nghf absX = x > 0 ? x : -x;
Preferences method get(key, xxx),
what is the second parameter used for?