8
public MyCircularQueue(int k) {13
public boolean enQueue(int value) {14
if(head == -1 && tail == -1) {15
// enqueue when the queue is empty17
q[tail] = value; // enQueue done20
if((tail == k-1 && head == 0) || tail+1 == head) {25
if(tail == k) // condition for circularity27
q[tail] = value; // enQueue done31
public boolean deQueue() {33
// check if q is already empty37
// only 1 element is there and head,tail both points same index38
head = tail = -1; // deQueue done41
head++; // deQueue done42
if(head == k) // condition for circularity59
public boolean isEmpty() {60
if(head == -1 && tail == -1) 65
public boolean isFull() {66
if(tail == k-1 || tail+1 == head) 73
* Your MyCircularQueue object will be instantiated and called as such:74
* MyCircularQueue obj = new MyCircularQueue(k);75
* boolean param_1 = obj.enQueue(value);76
* boolean param_2 = obj.deQueue();77
* int param_3 = obj.Front();78
* int param_4 = obj.Rear();79
* boolean param_5 = obj.isEmpty();80
* boolean param_6 = obj.isFull();