8
MyCircularQueue(int k) {14
boolean enQueue(int value) {15
if (head == -1 && tail == -1) {16
// enqueue when the queue is empty18
q[tail] = value; // enQueue done21
if ((tail == k - 1 && head == 0) || tail + 1 == head) {26
if (tail == k) // condition for circularity28
q[tail] = value; // enQueue done35
// check if q is already empty39
// only 1 element is there and head,tail both points same index40
head = tail = -1; // deQueue done43
head++; // deQueue done44
if (head == k) // condition for circularity51
if (head == -1) return -1;57
if (tail == -1) return -1;63
if (head == -1 && tail == -1) return true;69
if (tail == k - 1 || tail + 1 == head) return true;75
* Your MyCircularQueue object will be instantiated and called as such:76
* MyCircularQueue obj = new MyCircularQueue(k);77
* boolean param_1 = obj.enQueue(value);78
* boolean param_2 = obj.deQueue();79
* int param_3 = obj.Front();80
* int param_4 = obj.Rear();81
* boolean param_5 = obj.isEmpty();82
* boolean param_6 = obj.isFull();