Untitled
class Queue { private: int L = 0, R = -1; int q[5000]; public: Queue() { } /*----------------- Public Functions of Queue -----------------*/ bool isEmpty() { return L > R; } void enqueue(int data) { q[++R] = data; } int dequeue() { int data = (L <= R) ? q[L++] : -1; // If Queue has become empty, then re-initialise // L, R to start so that more values can be // accomodated. if (L > R) L = 0, R = -1; return data; } int front() { return (L <= R) ? q[L] : -1; } };