⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 quicksort.java

📁 洗牌游戏
💻 JAVA
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package Shuffle;/** * * @author DJ尐舞 */public class Quicksort {        static void sort(Integer[][] list){         qSort(list,0,list.length-1);    }    static void qSort(Integer[][] list,int low,int high){        if(low<high){           int pivotloc=partition(list,low,high);//           try{                qSort(list,low,pivotloc-1);                qSort(list,pivotloc+1,high);//           }//           catch(Exception e){//           System.out.println("high="+high+"low="+low);//           }        }    }    static int partition(Integer[][] list,int low,int high  ){        Integer temp[]=list[low];        Integer pivot[]=list[low];        while(low<high){ //            System.out.print("\n快排:");//             for(int i=0;i<list.length;i++){//                System.out.print(list[i][0]+" "); //             }                           while(low<high&&list[high][0]>=pivot[0])--high;            list[low]=list[high];            while(low<high&&list[low][0]<=pivot[0])++low;            list[high]=list[low];                     }        list[low]=temp;        return low;    }    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -