![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
九术沫
我愿为你的梦想插上翅膀
展开
-
队列的两种实现方式
数组实现 package com.queue; public class Queue_array { private int[] queue; private int size; private int h,t;//h队头 t队尾 public Queue_array() { this(5); } public Queue_array(int n) { queue = new int[n]; size = 0; h=-1; t=0; //其中 我的h,t规.原创 2021-01-24 21:31:02 · 180 阅读 · 0 评论 -
栈的两种实现(数组--链式)
数组实现 package com.stack; public class Stack_array { private int[] s;//栈数组 private int len; public Stack_array() { s = new int[10];//初始化大小 10 } public Stack_array(int num) { s = new int[num];//初始化大小 num } /* * 压入栈 */ public void pu.原创 2021-01-18 14:38:06 · 114 阅读 · 0 评论 -
链式线性表--java实现
public class LinkList { private Node head;//链表头 private int size;//节点个数 /* * 构造一个节点 结构 * 这个节点类 有两个构造方法 * Node node1 = new Node(); * Node node2 = new Node(val); * 这个现象叫方法重载 * 一个节点有两个属性,节点值 val 和 节点后驱 next,两个属性都是 public * 所以除了通过构造方法初始化属性.原创 2020-11-15 22:18:06 · 183 阅读 · 0 评论 -
数据结构---数组实现线性表(Java实现)
public class LineList { private int[] array; private int index;//已用空间最大下标 //初始化线性表 public void initList() { array = new int[10];//十个单位 index = -1;//已用空间最大下标 } //初始化线性表 public void initList(int n) { array = new int[n];//n个单位 index = -1;原创 2020-11-10 08:48:48 · 412 阅读 · 0 评论