博客
关于我
java快速排序算法
阅读量:409 次
发布时间:2019-03-05

本文共 684 字,大约阅读时间需要 2 分钟。

package paixu;import org.junit.Test;import java.util.Arrays;public class KuaiSu {    public int getMiddle(int[] arr, int low, int high){        int temp = arr[low];//选取中轴值        while(low
=temp){ high--; } arr[low] = arr[high];//比中轴小的移到左侧低端 while (low < high && arr[low]<=temp){ low++; } arr[high] = arr[low];//比中轴大的移到右侧高端 } arr[low] = temp;//把中轴放在大小交界处。 return low;//返回中轴位置 } public void quickSort(int[] arr, int low, int high){ if(low
0) { quickSort(arr,0,arr.length-1); } System.out.println(Arrays.toString(arr)); }}

 

转载地址:http://tyqwz.baihongyu.com/

你可能感兴趣的文章
ndk特定版本下载
查看>>
NDK编译错误expected specifier-qualifier-list before...
查看>>
Neat Stuff to Do in List Controls Using Custom Draw
查看>>
Necurs僵尸网络攻击美国金融机构 利用Trickbot银行木马窃取账户信息和欺诈
查看>>
Needle in a haystack: efficient storage of billions of photos 【转】
查看>>
NeHe OpenGL教程 07 纹理过滤、应用光照
查看>>
NeHe OpenGL教程 第四十四课:3D光晕
查看>>
Neighbor2Neighbor 开源项目教程
查看>>
neo4j图形数据库Java应用
查看>>
Neo4j图数据库_web页面关闭登录实现免登陆访问_常用的cypher语句_删除_查询_创建关系图谱---Neo4j图数据库工作笔记0013
查看>>