Untitled

 avatar
unknown
plain_text
2 years ago
396 B
14
Indexable
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;
	}
}
Editor is loading...