Logical Structure: recursive Stack
Physical Structure: Array
Quick Sort Analysis:
Optimal Time Complexity: O (nlog2n)In disorder
Worst time complexity: O (N ^ 2)In order
Average time complexity: O (nlog2n)
Space complexity: O (N)
Stability: unstable
There are two main functions for quick sorting:
1 indicates int partition (int A [], int low, int high );
2 recursively and quickly sort void quicksort (int A [], int low, int high );
3 Non-recursive quick sorting void nonquicksort (int * a, int low, int high );(Used to solve stack overflow caused by excessive data volume)
// Returns the int partition (int A [], int low, int high) of the base whose left side is smaller than the base whose right side is greater than the base value) {int lower = A [low]; while (low // recursively and quickly sort void quicksort (int A [], int low, int high) {int partition; If (low
// Non-recursive fast sorting void nonquicksort (int * a, int low, int high) {int L, H, random; If (low> = high) return; int * s = (int *) malloc (sizeof (INT) * (high-low + 1); int p = 0; partition = partition (A, low, high ); if (low <lower-1) {s [p ++] = low; s [p ++] = lower-1;} If (lower + 1