ArrayQueue Practice Quiz

Practice Problem

public interface Queue211<E> {
  boolean add(E e); // add e to the end of the queue. May throw an IllegalStateException
  E element(); // returns the front of the queue w/o removing
  boolean offer(E e); // inserts e to into the queue.
  E peek(); // returns the front of the queue or null.
  E poll(); // removes and returns the front of the queue or null.
  E remove(); // removes and returns the front of the queue, may throw an IllegalStateException.
}

public class ArrayQueue<E> implements Queue211<E> {
  private E[] data;
  private int front;
  private int rear;
  private int size;
  ...
  public boolean offer(E item) {
    // your code here.
  }
  ...
}

Time Remaining:

You can restart the timer by reloading the page.

Try to complete the problem in 15 minutes.

If you cannot complete the program in 15 minutes, you can watch me solve the problem in a text editor.