Java Reference
In-Depth Information
list and newNode refers to an unattached Node object. Show, in
pseudocode, the steps that would insert newNode behind cur-
rent in the list. Carefully consider the cases in which current
is referring to the first and last nodes in the list.
EX 13.4
Modify your answer to Exercise 13.3 assuming that the list was
set up as a doubly linked list, with both next and prev references.
EX 13.5
Would the front and rear references in the header node of a
linked list ever refer to the same node? Would they ever both
be null? Would one ever be null if the other was not? Explain
your answers using examples.
EX 13.6
Show the contents of a queue after the following operations are
performed. Assume the queue is initially empty.
enqueue (45);
enqueue (12);
enqueue (28);
dequeue();
dequeue();
enqueue (69);
enqueue (27);
enqueue (99);
dequeue();
enqueue (24);
enqueue (85);
enqueue (16);
dequeue();
EX 13.7
In terms of the final state of a queue, does it matter how
dequeue operations are intermixed with enqueue operations?
Does it matter how the enqueue operations are intermixed
among themselves? Explain using examples.
EX 13.8
Show the contents of a stack after the following operations are
performed. Assume the stack is initially empty.
push (45);
push (12);
push (28);
pop();
pop();
push (69);
push (27);
push (99);
pop();
Search WWH ::




Custom Search