堆栈特点 只能从顶部存取数据 “先进后出”原则 定义堆栈12345678910111213141516171819202122232425262728class StackByArray<T>{ private T[] stack; private int top; public StackByArray(int stack_size){ this.stack = new T[stack_size]; this.top = -1; } public boolean isEmpty(){} public boolean push(T data){} public T pop(){}}class StackByLink<T>{ private Node<T> stackTop; public StackByLink(){ ...
单向链表 定义链表节点 12345678class Node<T>{ T data; Node next; public Node(T data){ this.data = data; this.next = null; }} 定义链表 12345678910111213141516171819202122232425262728293031323334353637383940414243444546class LinkedList<T>{ private Node first; private Node last; private int size = 0; public LinkedList(){ this.first =null; this.last =null; } public boolean isEmpty(){retur ...