|
|
|
|---|---|
|
|
|
|
and No late submissions will be accepted |
|
Your midterm exam will is in two parts:
next
and previous node references). In addition, you will also be writing a driver to use your DoubleEndedQueue.
You will write the DoubleEndedQueue.java class which will implement the
DoubleEndedQueueInterface
, from your
zyBooks textbook
DoubleEndedQueue.java will be implemented as a doubly linked structure.
Your DoubleEndedQueue class must have the following private instance variables:
Node in the DoubleEndedQueue, initially set to null.
Node in the DoubleEndedQueue, initially set to null.
int coresponding to the number of elements in the DoubleEndedQueue, initially set to 0.
Your ElementIterator will extend Iterator. Please see the documentation for the
Iterator<T>
. Your ElementIterator class will implement both the hasNext() and next()
methods of this interface.
Your DoubleEndedQueue class must implement the Iterable<T> interface. Implementing this
interface requires that your provide a method in your DoubleEndedQueue with the following signature:
public Iterator. Please see the documentation for the
Iterable<T>
. The Iterator you will build and return will actually be an ElementIterator.
You will use the provided Node.java which can be downloaded from
from your
zyBooks textbook
.
Please note that each Node has references to both the previous and
the next nodes as well as a reference to the contained element.
You will write the Driver.java class to test your implementation of DoubleEndedQueue.java.
Your Driver.java class will implement the
Driver Interface
. The interface may be downloaded from
from your
zyBooks textbook
.
Please submit the completed exam in your zyBooks textbook .