文件名称:leetcode切割分组-java_algorithm:排序算法演示
文件大小:249KB
文件格式:ZIP
更新时间:2024-07-26 19:06:20
系统开源
leetcode切割分组 java_algorithm this is a sorting algorithm demo. created by InterlliJ. that is the java main program. ! com.sample.sort包下 平均时间复杂度 O(n^2) 空间复杂度 O(1) BubbleSort 冒泡排序 SelectionSort 选择排序 InsertionSort 插入排序 平均时间复杂度 O(n (log n)^2) 空间复杂度 O(1) ShellSort 希尔排序 | 优化版插入排序;多轮步长缩小的方式,步长为 x = x * k + 1 每轮缩短的方式,如:15 > 7 > 3 > 1,并确保最后一轮步长为1 平均时间复杂度 O(n (log n) 空间复杂度 O(1) MergeSort | 归并排序 | 外排序 空间复杂度 O(n),需申请与原空间同大空间 HeapSort 堆排序 QuickSort 快速排序 平均时间复杂度 O(n + k) 空间复杂度 O(k) CountingSort | 计数排序 | 用一个计算器