随笔分类 -  Java_数据结构源码实现

摘要:1.Queue接口: public interface Queue<E> { int getSize(); boolean isEmpty(); void enqueue(E e); E dequeue(); E getFront(); } 2.使用Array数组实现ArrayQueue: publ 阅读全文
posted @ 2022-04-06 23:28 2022年总冠军gogogo 阅读(42) 评论(0) 推荐(0) 编辑
摘要:1.Stack接口: public interface Stack<E> { int getSize(); boolean isEmpty(); void push(E e); E pop(); E peek(); } 2.借助LinkedList链表实现LinkedListStack栈: publ 阅读全文
posted @ 2022-04-06 23:20 2022年总冠军gogogo 阅读(26) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2022-04-06 23:08 2022年总冠军gogogo 阅读(42) 评论(0) 推荐(0) 编辑
摘要:(一)基本类型数组实现 public class Array { private int[] data; private int size; // 构造函数,传入数组的容量capacity构造Array public Array(int capacity){ data = new int[capac 阅读全文
posted @ 2022-04-03 23:59 2022年总冠军gogogo 阅读(26) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示