![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
排序
小纸人人
小纸人的算法学习之路,不定期的分享一些有趣的算法题目!
展开
-
排序(五种冒泡,插入,选择,堆,快速)
/** * 快速排序 * @author 小纸人 * */ public class KuaiSuSort { public static void main(String[] args) { int[] a = {3,2,5,8,4,7,6,9,1,4}; quickSort(a, 0, a.length - 1); System.out.println("快速排序结...原创 2019-03-25 19:16:12 · 182 阅读 · 0 评论 -
快速排序改进版
import java.util.Arrays; public class QuickSort { public static void quickSort(int[] arr) { if (arr == null || arr.length < 2) { return; } quickSort(arr, 0, arr.length - 1); } public...原创 2019-04-10 22:33:28 · 592 阅读 · 1 评论 -
归并排序
import java.util.Arrays; /** * * * @author 小纸人 * */ public class MergeSort { public static void mergeSort(int[] arr) { if(arr.length <= 1 || arr == null) { return; } mergeSort(arr...原创 2019-04-08 11:52:34 · 88 阅读 · 0 评论 -
快速排序非递归实现
import java.util.Arrays; import java.util.Stack; public class Main { /** * 采用非递归的方法,首先要想到栈的使用,通过阅读递归调用部分的代码,思考如何用栈来代替。 * 递归调用的核心代码是 temp = partition(a, low, high); * 每次循环都必须包含这句核...原创 2019-08-31 02:12:41 · 320 阅读 · 0 评论 -
快排非递归
import java.util.Arrays; public class TestQuickSort { public static int partion(int []array,int low,int hign){ int tmp=array[low]; while(low<hign){ while(low<...原创 2019-09-09 13:13:33 · 87 阅读 · 0 评论