排序算法之快速排序 JAVA快速排序算法

        public static void quickSort(int[] arr, int low , int height){
            int l=low, h = height;
            if(low < height){
                int temp = arr[low];
                while(low < height){
                    
                    while(low < height && temp < arr[height]){
                        height --;
                    }
                    arr[low] = arr[height];
                    
                    while(low < height  && temp > arr[low]){
                        low ++;
                    }
                    arr[height] = arr[low];
                    arr[low] = temp;
                }
                quickSort(arr, l, low-1);
                quickSort(arr, low+1, h);
            }
            
        }

 

posted @ 2015-05-17 10:26  rubekid  阅读(179)  评论(0编辑  收藏  举报