随笔分类 -  数据结构

摘要:``` package test; public class MergeSort { public static void main(String[] args) { // TODO Auto generated method stub int[] arr = { 10, 9, 8, 7, 6, 5 阅读全文
posted @ 2018-08-27 22:05 LynnMin 阅读(152) 评论(0) 推荐(0)
摘要:``` package test; public class HeapSort { public static void main(String[] args) { int[] arr = {10,9,8,7,6,5,4,3,2,1}; System.out.print("排序前;"); print 阅读全文
posted @ 2018-08-27 20:15 LynnMin 阅读(109) 评论(0) 推荐(0)
摘要:``` package demo; public class ShellSort { public static void main(String[] args) { int[] arr = {5,4,3,2,1,0}; printArr(arr); shellSort(arr); printArr 阅读全文
posted @ 2018-08-27 16:42 LynnMin 阅读(108) 评论(0) 推荐(0)
摘要:``` package demo; / 快速排序; @author Lynn / public class QuickSort { public static void main(String[] args) { int[] arr = { 50, 10, 90, 30, 70, 40, 80, 6 阅读全文
posted @ 2018-08-25 14:46 LynnMin 阅读(179) 评论(0) 推荐(0)
摘要:``` package demo; / 插入排序; @author Lynn / public class InsertionSort { public static void main(String[] args) { int[] arr = {10,7,2,4,8,6,1,9}; System. 阅读全文
posted @ 2018-08-24 14:06 LynnMin 阅读(111) 评论(0) 推荐(0)
摘要:![](https://images2018.cnblogs.com/blog/873621/201808/873621-20180824111355556-1769590637.png) 阅读全文
posted @ 2018-08-24 11:14 LynnMin 阅读(192) 评论(0) 推荐(0)
摘要:``` package demo; / 简单排序 时间复杂度O(n^2) 不稳定; @author Lynn / public class SimpleSelectSort { public static void main(String[] args) { int[] arr = {10,7,2, 阅读全文
posted @ 2018-08-24 11:11 LynnMin 阅读(146) 评论(0) 推荐(0)
摘要:运行结果 阅读全文
posted @ 2018-08-23 17:37 LynnMin 阅读(140) 评论(0) 推荐(0)
摘要:概念     二叉排序树,又称二叉查找树。它或者是一棵空树,或者是具有下列性质的二叉树: ①若它的左子树不空,则左子树上所有节点的值均小于它的根节点的值。 ② 若它的右子树不空,则右子树上所有节点的值均大于它的根节点的值。 ③ 它的左右子树也分别为二叉排序树。 阅读全文
posted @ 2018-08-20 14:43 LynnMin 阅读(206) 评论(0) 推荐(0)
摘要:使用邻接矩阵进行存储 原图 调整后 package graph; import java.util.ArrayList; import java.util.LinkedList; public class BFSTraverse { private static ArrayList list = n 阅读全文
posted @ 2018-08-14 13:30 LynnMin 阅读(730) 评论(0) 推荐(0)
摘要:使用邻接矩阵进行存储; package graph; import java.util.ArrayList; public class DFSTraverse { private static ArrayList list = new ArrayList(); // 邻接矩阵存储; public s 阅读全文
posted @ 2018-08-14 11:58 LynnMin 阅读(447) 评论(0) 推荐(0)