0
/ 2.0
Use this interface definition to solve this problem.
public interface QueueADT<E> { /* Set the queue to its initial state. */...
Use this interface definition to solve this problem.
public interface QueueADT<E> {
/* Set the queue to its initial state. */
public void clear();
/* Add an element to the queue (on rear). */
public boolean enqueue(E it);
/* Remove the element from front of the queue and
return it. */
public E dequeue();
/* Returns the element from front of the queue without
* removing it. */
public E frontValue();
/* Return the number of elements in the queue. */
public int numElements();
/* Is the queue empty? */
public boolean isEmpty();
}
Write a method to move the first element from a queue
to the back of the list. You should check that the queue
is not null and it has more than 1 element. If queue
is null
or if the queue
has less than 2 elements, it should do nothing.
(Think about it, if the queue has less than 2, the front of the
queue is also the tail element, so moving front to back makes no
difference) Make sure you use the interface from above.
Your feedback will appear here when you check your answer.