[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/git-jhy/JavaArithmetic/master/src/sort/QuickSort.java [Back]  [Original]

package sort;

import java.util.Stack;

/**
 * Created by ozc on 2018/3/17.
 *
 * @author ozc
 * @version 1.0
 */
public class QuickSort {


    public static void main(String[] args) {
        //int[] arr = {1, 4, 5, 67, 2, 7, 8, 6, 9, 44, 34, 5, 5, 2, 34, 5, 62, 42, 1, 1324, 2346};
        int[] arr = {23, 34, 33, 56, 45};
        quickSort(arr, 0, arr.length - 1);


        System.out.println("Java3y   " + arr);
    }

    /**
     * 
     *
     * @param arr
     * @param L   
     * @param R   
     */
    public static void quickSort(int[] arr, int L, int R) {
        int i = L;
        int j = R;

        //
        int pivot = arr[(L + R) / 2];

        //
        while (i  arr[i])
                i++;

            //
            while (pivot < arr[j])
                j--;

            //()()
            if (i  key) {
                    stack.push(key + 1);
                    stack.push(hi);//keykey
                }
            }
        }
    }

    public static int partition(int[] a, int low, int high) {

        // key
        int key = a[low];

        while (low < high) {

            // key
            while (a[high] >= key && low < high) {
                high--;
            }

            a[low] = a[high];

            // key
            while (a[low] 

Web Proxy Viewer  |  New URL  |  Original Page