随笔分类 -  算法与数据结构

算法与数据结构的介绍与举例
摘要:/** * 使用数组模拟队列 * @author Administrator */ public class ArrayQueueDemo { public static void main(String[] args) { ArrayQueue arrayQueue = new ArrayQueu 阅读全文
posted @ 2020-09-05 10:28 清风商 阅读(177) 评论(0) 推荐(0)
摘要:import java.util.ArrayList; import java.util.List; //注意:使用二分查找的前提是 该数组是有序的. public class BinarySearch { public static void main(String[] args) { //int 阅读全文
posted @ 2020-07-31 17:56 清风商 阅读(144) 评论(0) 推荐(0)
摘要:import java.util.Arrays; public class QuickSort { public static void main(String[] args) { int[] arr = {-9,78,567,23,0,70,78 -1,900, 4561}; quickSort( 阅读全文
posted @ 2020-07-31 16:22 清风商 阅读(144) 评论(0) 推荐(0)
摘要:/** * 选择排序 时间复杂度O(n^2) * @author Administrator * */ public class SelectSort { public static void main(String[] args) { int [] arr = {1,-3,4,-2,5,67,32 阅读全文
posted @ 2020-07-29 10:57 清风商 阅读(112) 评论(0) 推荐(0)
摘要:冒泡排序(Bubble Sorting)的基本思想是:通过对待排序序列从前向后(从下标较小的元素开始) ,依次比较相邻元素的值,若发现逆序则交换,使值较大的元素逐渐从前移向后部,就象水底下的气泡一样逐渐向上冒。 /** * 冒泡算法 * @author Administrator * */ publ 阅读全文
posted @ 2020-07-28 17:14 清风商 阅读(134) 评论(0) 推荐(0)