Home > Back-end >  Cfree why there will be a quick sort. Exe to stop working?
Cfree why there will be a quick sort. Exe to stop working?

Time:10-06

#include
# define N 10
Void quicksort (int a [], int low, int high);
Int the split (int a [], int low, int high);

Int main (void) {
Int a [N], I;

Entr printf (" % d items to be sorted: ", N);
for(i=0; iThe scanf (" % d ", & amp; A [I]);
A, quicksort (0, N - 1);
Printf (" the sorted items are: ");
for(i=0; iPrintf (" % d ", a [I]);
return 0;
}
Int the split (int a [], int low, int high) {
Int w=a, [low].
For (;; ) {
While (lowIf (low>=high) break;
A [low++]=a, [high].

While (low=a [low]) low++;
If (low>=high) break;
A (high -)=a, [low].
}
A [high]=w;
Return high;
}
Void quicksort (int a [], int low, int high) {
Int the middle;
If (low>=high) return;
Middle=split (a, low, high);
Quicksort (a, low, middle - 1);
Quicksort (a, middle - 1, high);

}

CodePudding user response:

Array declaration, N no value is variable, you don't have to a dynamic array
  • Related