![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
我滴名痣叫老八
这个作者很懒,什么都没留下…
展开
-
JAVA:递归与迷宫问题
public class Test { public static void main(String[] args) { int[][] map = new int[8][7]; // 先创建一个二维数组,模拟迷宫 for(int i=0;i<7;i++){ // 建筑上下墙 map[0][i] = 1; map[7][i] = 1; } for(int j=0;j<8.原创 2022-05-06 23:48:35 · 730 阅读 · 0 评论 -
JAVA:栈
//在学习栈之前,只需要明确:栈满的时候top的值是maxSize-1,// 即栈顶值为:stack[top](或stack[maxSize-1])public class StackTest { public static void main(String[] args) { ArrayStack a1 = new ArrayStack(5); a1.addStack(5); a1.addStack(4); a1.addSt.原创 2022-05-01 22:08:26 · 990 阅读 · 0 评论 -
JAVA:数据结构(5)约瑟夫问题
public class LaoBa_233 { public static void main(String[] args) { // 测试一把看看构建环形链表,和遍历是否ok CircleSingleLinkedList circleSingleLinkedList = new CircleSingleLinkedList(); circleSingleLinkedList.addBoy(125);// 加入5个小孩节点 cir.原创 2022-05-01 21:19:22 · 385 阅读 · 0 评论 -
JAVA:数据结构(5) 双向链表
public class Test { public static void main(String[] args) { HeroNode h1 = new HeroNode(1,"001","111"); HeroNode h2 = new HeroNode(2,"002","222"); HeroNode h3 = new HeroNode(3,"003","333"); HeroNode h4 = new HeroNode(4,.原创 2022-04-27 15:52:56 · 1026 阅读 · 0 评论 -
JAVA:数据结构(4)单向链表
public void add(HeroNode heroNode) { //普通的插入结点的方法(俗称尾插法)。没有顺序,来一个往后插一个。 HeroNode temp = head; //头结点head不能动,所以需要一个辅助结点temp,且令它指向头结点 while(true) { //无限循环,但是可以用break;跳出。 if(temp.next == null) { //temp.next == .原创 2022-04-18 23:13:42 · 302 阅读 · 0 评论 -
JAVA:数据结构(3)数组表示循环队列
public class Test { public static void main(String[] args) { cycleArrayQueue caq1 = new cycleArrayQueue(4); caq1.inCycleQueue(1); caq1.inCycleQueue(2); caq1.inCycleQueue(3); caq1.checkEachElement(); Syst.原创 2022-04-15 20:24:58 · 516 阅读 · 0 评论 -
JAVA:数据结构(2)——数组表示队列
public class Test { public static void main(String[] args) { Queue q1 = new Queue(5); System.out.println(q1.isEmpty()); // true q1.addQueue(1); q1.addQueue(2); q1.addQueue(3); q1..原创 2022-04-14 23:25:01 · 628 阅读 · 0 评论 -
JAVA:我的第一个数据结构——二维数组
算是自己写的吧 虽然得是不是得看一眼思路public class Test { public static void main(String[] args) { int[][] x1 = new int[5][5]; x1[0][2] = 1; x1[0][3] = 3; x1[1][0] = 2; x1[2][2] = 8; x1[3][3] = 4; x1[4][0] = 1;原创 2022-04-14 19:12:10 · 697 阅读 · 0 评论