public class QuickSort extends Object
Quicksort is a comparison sort. A comparison sort is a type of sorting algorithm that only reads the list elements through a single abstract comparison operation (often a "less than or equal to" operator) that determines which of two elements should occur first in the final sorted list. The only requirement is that the operator obey the three defining properties of a total order:
Quicksort, however, is not a stable sort in efficient implementations. Stable sorting algorithms maintain the relative order of records with equal keys. If all keys are different then this distinction is not necessary. But if there are equal keys, then a sorting algorithm is stable if whenever there are two records(let's say R and S) with the same key, and R appears before S in the original list, then R will always appear before S in the sorted list.
For speed of execution, we implement it without recursion. Instead, we requires an auxiliary array (stack) of storage, of length 2 log2 n. When a subarray has gotten down to size 7, we sort it by straight insertion.
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
static int[] |
sort(double[] arr) |
Sorts the specified array into ascending numerical order.
|
static void |
sort(double[] arr,
double[] brr) |
This is an effecient implementation Quick Sort algorithm without
recursive.
|
static void |
sort(double[] arr,
double[] brr,
int n) |
This is an effecient implementation Quick Sort algorithm without
recursive.
|
static void |
sort(double[] arr,
int[] brr) |
Besides sorting the array arr, the array brr will be also
rearranged as the same order of arr.
|
static void |
sort(double[] arr,
int[] brr,
int n) |
This is an effecient implementation Quick Sort algorithm without
recursive.
|
static void |
sort(double[] arr,
Object[] brr) |
Besides sorting the array arr, the array brr will be also
rearranged as the same order of arr.
|
static void |
sort(double[] arr,
Object[] brr,
int n) |
This is an effecient implementation Quick Sort algorithm without
recursive.
|
static int[] |
sort(float[] arr) |
Sorts the specified array into ascending numerical order.
|
static void |
sort(float[] arr,
float[] brr) |
Besides sorting the array arr, the array brr will be also
rearranged as the same order of arr.
|
static void |
sort(float[] arr,
float[] brr,
int n) |
This is an effecient implementation Quick Sort algorithm without
recursive.
|
static void |
sort(float[] arr,
int[] brr) |
Besides sorting the array arr, the array brr will be also
rearranged as the same order of arr.
|
static void |
sort(float[] arr,
int[] brr,
int n) |
This is an effecient implementation Quick Sort algorithm without
recursive.
|
static void |
sort(float[] arr,
Object[] brr) |
Besides sorting the array arr, the array brr will be also
rearranged as the same order of arr.
|
static void |
sort(float[] arr,
Object[] brr,
int n) |
This is an effecient implementation Quick Sort algorithm without
recursive.
|
static int[] |
sort(int[] arr) |
Sorts the specified array into ascending numerical order.
|
static void |
sort(int[] arr,
int[] brr) |
Besides sorting the array arr, the array brr will be also
rearranged as the same order of arr.
|
static void |
sort(int[] arr,
int[] brr,
int n) |
This is an effecient implementation Quick Sort algorithm without
recursive.
|
static void |
sort(int[] arr,
Object[] brr) |
Besides sorting the array arr, the array brr will be also
rearranged as the same order of arr.
|
static void |
sort(int[] arr,
Object[] brr,
int n) |
This is an effecient implementation Quick Sort algorithm without
recursive.
|
static <T extends Comparable<? super T>> |
sort(T[] arr) |
Sorts the specified array into ascending order.
|
static <T extends Comparable<? super T>> |
sort(T[] arr,
int[] brr) |
Besides sorting the array arr, the array brr will be also
rearranged as the same order of arr.
|
static <T extends Comparable<? super T>> |
sort(T[] arr,
int[] brr,
int n) |
This is an effecient implementation Quick Sort algorithm without
recursive.
|
static <T> void |
sort(T[] arr,
int[] brr,
int n,
Comparator<T> comparator) |
This is an effecient implementation Quick Sort algorithm without
recursive.
|
static <T extends Comparable<? super T>> |
sort(T[] arr,
Object[] brr) |
Besides sorting the array arr, the array brr will be also
rearranged as the same order of arr.
|
static <T extends Comparable<? super T>> |
sort(T[] arr,
Object[] brr,
int n) |
This is an effecient implementation Quick Sort algorithm without
recursive.
|
public static int[] sort(int[] arr)
public static void sort(int[] arr,
int[] brr)
public static void sort(int[] arr,
int[] brr,
int n)
public static void sort(int[] arr,
Object[] brr)
public static void sort(int[] arr,
Object[] brr,
int n)
public static int[] sort(float[] arr)
public static void sort(float[] arr,
int[] brr)
public static void sort(float[] arr,
int[] brr,
int n)
public static void sort(float[] arr,
float[] brr)
public static void sort(float[] arr,
float[] brr,
int n)
public static void sort(float[] arr,
Object[] brr)
public static void sort(float[] arr,
Object[] brr,
int n)
public static int[] sort(double[] arr)
public static void sort(double[] arr,
int[] brr)
public static void sort(double[] arr,
int[] brr,
int n)
public static void sort(double[] arr,
double[] brr)
public static void sort(double[] arr,
double[] brr,
int n)
public static void sort(double[] arr,
Object[] brr)
public static void sort(double[] arr,
Object[] brr,
int n)
public static <T extends Comparable<? super T>> int[] sort(T[] arr)
public static <T extends Comparable<? super T>> void sort(T[] arr, int[] brr)
public static <T extends Comparable<? super T>> void sort(T[] arr, int[] brr, int n)
public static <T> void sort(T[] arr,
int[] brr,
int n,
Comparator<T> comparator)
public static <T extends Comparable<? super T>> void sort(T[] arr, Object[] brr)
public static <T extends Comparable<? super T>> void sort(T[] arr, Object[] brr, int n)
Copyright © 2019. All rights reserved.