算法
Hide on Globe
别让一生都在等待.
展开
-
堆排序
public class HeapSort { public static void heapSort(int[] data) { if (data == null || data.length == 0) { return ; } for (int i = 0; i < data.length; i++) { ...原创 2018-08-08 15:53:54 · 108 阅读 · 0 评论 -
冒泡排序
平均时间复杂度: O(n^2) 最优时间复杂度: O(n) 最差时间复杂度: O(n^2) 空间复杂度 : O(1) 稳定性 : 稳定 public class BubbleSort { public static void bubbleSort(int[] data) { boolean sign = true; ...原创 2018-08-08 16:06:01 · 148 阅读 · 0 评论 -
直接选择排序
平均时间复杂度: O(n^2) 最优时间复杂度: O(n^2) 最差时间复杂度: O(n^2) 空间复杂度 : O(1) 稳定性 : 稳定 public class SelctionSort { public static void selctionSort(int[] data) { int min; for (...原创 2018-08-08 16:10:56 · 208 阅读 · 0 评论 -
直接插入排序
平均时间复杂度: O(n^2) 最优时间复杂度: O(n) 最差时间复杂度: O(n^2) 空间复杂度 : O(1) 稳定性 : 稳定 public class InsertionSort { public static void insertionSort(int[] data) { for (int i = 1; i <...原创 2018-08-08 16:24:07 · 119 阅读 · 0 评论 -
归并排序
平均时间复杂度: O(n*logn) 最优时间复杂度: O(n*logn) 最差时间复杂度: O(n*logn) 空间复杂度 : O(n) 稳定性 : 稳定 public class MergeSort { public static void mergeSort(int[] data) { if (data == null ...原创 2018-08-09 10:48:04 · 131 阅读 · 0 评论 -
随机快速排序
平均时间复杂度: O(n*logn) 最优时间复杂度: O(n*logn) 最差时间复杂度: O(n*logn) 空间复杂度 : O(logn) 稳定性 : 不稳定 public class QuickSort { public static void quickSort(int[] data) { if (data == nul...原创 2018-08-09 10:47:45 · 143 阅读 · 0 评论