下压堆栈(链表实现): import java.util.Iterator; public class LinkedStack<Item> implements Iterable<Item> { public class Node { Item item; Node next; } private Node frist; private int N = 0; public boolean isEmpty() { return N == 0; } public int size()
下压(LIFO)栈:可以动态调整数组大小的实现 import java.util.Iterator; public class ResizingArrayStack<Item> implements Iterable<Item> { private int N = 0; private Item[] a = (Item[]) new Object[1]; public boolean isEmpty() { return N == 0; } public int size() {
下压(LIFO)栈:能够动态调整数组大小的实现 import java.util.Iterator; public class ResizingArrayStack<Item> implements Iterable<Item> { private int N = 0; private Item[] a = (Item[]) new Object[1]; public boolean isEmpty() { return N == 0; } public int size() {