queue.java
来自「图论中关于简单无向图的深度」· Java 代码 · 共 52 行
JAVA
52 行
/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class Queue { private class QueueNode { public int data; public QueueNode link; } public QueueNode front; public QueueNode rear; public Queue() { front=null; rear=null; } public boolean isEmpty() { return (front==null); } public void ENQUEUE(int ne) { QueueNode newNode=new QueueNode(); newNode.data=ne; newNode.link=null; if (front==null) { front=newNode; rear=newNode; } else { rear.link=newNode; rear=rear.link; } } public int DEQUEUE() { if(isEmpty()) { return -1; } int temp=front.data; front=front.link; if(front==null) { rear=null; } return temp; } }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?