| CIT 594 First Midterm Spring 2003, Dave Matuszek |
Name _______________________________________
|
A |
B |
|
|
|
|
X |
Y |
undefined | undefined |
(X . Y) |
undefined |
X |
|
undefined |
Y |
(X Y Z) |
undefined |
|
|
undefined |
Y |
(Y Z) |
(NIL Y Z) or |
(X) |
|
X |
Y |
((X) Y Z) |
(X Y Z) |
(X) |
|
X |
undefined |
((X)) |
(X) |
|
|
undefined |
undefined |
(( )) or (NIL) |
( ) or NIL |
|
Y |
( ) or NIL |
undefined |
((( )) . Y) or ((NIL) . Y) |
undefined or (NIL . Y) |
(EQUAL '(A B C) '(A . (B . (C . NIL)))
) T((A
. B) . (C . NIL)) ((A
. B) C)((A
. B) . (C . NIL))
A
is n and the length of list B
is m , give the Big-O running time of each of the
following:
(CAR A) O(1)
(CDR A) O(1)
(CONS A B) O(1)
(APPEND A B) O(n)COND you can use the fact that all
previous tests have returned false .for (int i = 0; i < array.length; i++)
array[i] = 0;class Node {int value; Node previous; Node next; }badNode is a reference to a node in a doubly-linked list.badNode from the list
it is in.Iterator
interface, along with their parameter types and return types. Do not tell
what each method does.Arrays class (java.util.Arrays).
(Just names, please.)Collection interface.Vector
v = new Vector(10) is executed. Name the two types and tell
what is put into each type.equals.compareTo
is consistent with equals?Cell is defined as class Cell { int value;
Cell next; },Cells are joined together to form a linked list,first is a reference to the first cell in the
list
in the list.