![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
java排序随笔
Runnerycq
女努冲刺
展开
-
java排序之贰------堆排序代码
package com.xxzzycq.sort;public class Heapsort{ public int[] data; private void swap(int[] exchange, int i, int j) { int temp = exchange[i]; exchange[i] = exchange[j]; exchange[原创 2013-09-24 21:03:44 · 673 阅读 · 0 评论 -
java排序之伍------插入排序代码
package com.xxzzycq.sort;public class InsertionSort{ public static void insertSort(Comparable[] data) { for(int i = 1; i < data.length; i++) { if(data[i-1].compareTo(data[i]) > 0) {原创 2013-09-26 21:01:51 · 555 阅读 · 0 评论 -
java排序之肆------归并排序代码
package com.xxzzycq.sort;public class MergeSort{ public static void mergeSort(Comparable[] data, int min, int max) { if(min < max) { int mid = (min + max)/2; mergeSort(data, min, mid);原创 2013-09-26 19:54:31 · 630 阅读 · 0 评论 -
java排序之叁------选择排序代码
package com.xxzzycq.sort;public class SelectionSort{ private static void swap(Comparable[] data, int i, int j) { Comparable temp = data[i]; data[i] = data[j]; data[j] = temp; } public s原创 2013-09-26 19:30:44 · 557 阅读 · 0 评论 -
java排序之壹------快速排序代码
package com.xxzzycq.sort;public class QuickSort{ public int data[]; private int partition(int sortArray[], int low, int high) { int pivot = sortArray[low]; while(low {原创 2013-09-24 19:44:52 · 610 阅读 · 0 评论 -
java排序之壹------快速排序代码(改进)
package com.xxzzycq.sort;public class Sorting{ public static void swap(Comparable[] data, int i, int j) { Comparable temp = data[i]; data[i] = data[j]; data[j] = temp; } public static v原创 2013-09-25 09:33:10 · 812 阅读 · 0 评论