graphstack.java

来自「本软件是使用java 开发的」· Java 代码 · 共 36 行

JAVA
36
字号
package datastructure;

class GraphStack {
  public GraphStack() {
    st = new int[20];
    top = -1;
  }

  public void push(int i) {
    st[++top] = i;
  }

  public int pop() {
    return st[top--];
  }

  public int peek() {
    return st[top];
  }

  public boolean isEmpty() {
    return top == -1;
  }

  public int size() {
    return top + 1;
  }

  public int peekN(int i) {
    return st[i];
  }

  private final int SIZE = 20;
  public int st[];
  private int top;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?