数据结构与算法-排序
MrYu1025
这个作者很懒,什么都没留下…
展开
-
堆排序的java实现
public class MaxHeap { private Integer[] data; private int count; private int capacity; public MaxHeap(int capacity){ data = new Integer[capacity+1]; count = 0;原创 2017-11-10 09:50:08 · 181 阅读 · 0 评论 -
选择排序算法的java实现
/** * 选择排序 * n表示数组中元素的个数 * Created by Administrator on 2017/11/4 0004. */ public class SelectSort { public static void selectSort(int[] arr,int n){ for(int i=0;i<n;i++){ int ind原创 2017-11-04 14:18:10 · 181 阅读 · 0 评论 -
快速排序的Java实现(二路快排)
开始从一边遍历,如果遇到arr[i]>l,那么开始遍历另一边,知道另一边遇到arr[j]/** *快速排序,默认是l=0,r=arr.length-1 */ public static void quickSort(int[] arr,int l,int r){ if(l < r){ int i = l,j = r,x = arr[l];原创 2017-10-25 18:22:33 · 301 阅读 · 0 评论