Untitled

mail@pastecode.io avatar
unknown
plain_text
8 months ago
396 B
10
Indexable
Never
class queue {
	static int[] Data = new int[400];
	static int front, rear;

	public queue() {
		this.front = this.rear = -1;
	}

	void reset() {
		front = rear = -1;
	}

	public void enQueue(int value) {
		Data[++rear] = value;
	}

	int deQueue() {
		return Data[++front];
	}

	boolean isEmpty() {
		if (this.front == this.rear) {
			return true;
		}
		return false;
	}
}