Use two index variables head and tail


Implement a queue as a circular array as follows: Use two index variables head and tail that contain the index of the next element to be removed and the next element to be added. After an element is removed or added, the index is incremented. After a while, the tail element will reach the top of the array. Then it "wraps around" and starts again at 0. For that reason, the array is called "circular".

public class CircularArrayQueue{
private int head;
private int tall;
private int theSize;
private Object[] elements;

public CircularArrayQueue(int capacity){. . . . .}

public void add(object x){. . . . .}

public Object remove(){. . . . .}

public int size(){. . . . .}
}

This implementation supplies a bounded queue that can eventually fill up. this program needs 2 classes (2 separate .java files), one of which is the tester class. write javadoc for all methods

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Use two index variables head and tail
Reference No:- TGS0124960

Expected delivery within 24 Hours