随笔分类 - Java_数据结构源码实现
摘要:1.Queue接口: public interface Queue<E> { int getSize(); boolean isEmpty(); void enqueue(E e); E dequeue(); E getFront(); } 2.使用Array数组实现ArrayQueue: publ
阅读全文
摘要:1.Stack接口: public interface Stack<E> { int getSize(); boolean isEmpty(); void push(E e); E pop(); E peek(); } 2.借助LinkedList链表实现LinkedListStack栈: publ
阅读全文
摘要:LinkedList源码实现: public class LinkedList<E> { private class Node{ public E e; public Node next; public Node(E e, Node next){ this.e = e; this.next = ne
阅读全文
摘要:(一)基本类型数组实现 public class Array { private int[] data; private int size; // 构造函数,传入数组的容量capacity构造Array public Array(int capacity){ data = new int[capac
阅读全文