java实现队列与循环队列
队列
public class Queue {
private int maxSize;
private int front;
private int rear;
private int[] arr;
public Queue(int maxSize) {
this.maxSize = maxSize;
arr = new int[maxSize];
front = -1;
rear = -1;
}
// 判断队列是否满
public boolean isFull() {
return rear == maxSize - 1;
}
// 判断队列是否空
public boolean isEmpty() {
return front == rear;
}
// 入队
public void inQueue(int n) {
java实现队列与循环队列最先出现在Python成神之路。
共有 0 条评论