| CIT 594 First Midterm Spring 2003, Dave Matuszek |
Name _______________________________________
|
A |
B |
|
|
|
|
X |
Y |
|
|
|
|
X |
|
|
|
|
|
|
|
|
|
|
|
(X) |
|
|
|
|
|
(X) |
|
|
|
|
|
|
|
|
|
|
|
|
Y |
|
|
|
|
(EQUAL '(A B C) '(A . (B . (C . NIL)))
) ((A
. B) . (C . NIL)) ((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)
(CDR A)
(CONS A B)
(APPEND A B)COND you can use the fact that ________________________.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.