#include <stdio.h>
void swap(int *a, int *b);
void printArray(int *arr, int size);
int partition(int *arr, int lo, int hi) {
int pivot = arr[hi];
int i = lo - 1;
for (int j = lo; j <= hi - 1; j++) {
if (arr[j] < pivot) {
i++;
swap(&arr[i], &arr[j]);
}
}
swap(&arr[i + 1], &arr[hi]);
return i + 1;
}
void quicksort(int *arr, int lo, int hi) {
if (lo < hi) {
int pi = partition(arr, lo, hi);
quicksort(arr, lo, pi - 1);
quicksort(arr, pi + 1, hi);
}
}
int main(void) {
int c;
int arr[c];
for (int i = 0; i < c; i++) {
}
quicksort(arr, 0, c - 1);
printArray(arr, sizeof(arr) / sizeof(arr[0]));
return 0;
}
// BELOW IS BASIC FUNCTIONS TO SWAP AND PRINT THE ARRAY
void swap(int *a, int *b) {
int temp = *a;
*a = *b;
*b = temp;
}
void printArray(int *arr, int size) {
for (int i = 0; i < size; i++) {
if (i + 1 < size) {
}
}
}
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp2b2lkIHN3YXAoaW50ICphLCBpbnQgKmIpOwp2b2lkIHByaW50QXJyYXkoaW50ICphcnIsIGludCBzaXplKTsKCmludCBwYXJ0aXRpb24oaW50ICphcnIsIGludCBsbywgaW50IGhpKSB7CiAgaW50IHBpdm90ID0gYXJyW2hpXTsKCiAgaW50IGkgPSBsbyAtIDE7CgogIGZvciAoaW50IGogPSBsbzsgaiA8PSBoaSAtIDE7IGorKykgewogICAgaWYgKGFycltqXSA8IHBpdm90KSB7CiAgICAgIGkrKzsKICAgICAgc3dhcCgmYXJyW2ldLCAmYXJyW2pdKTsKICAgIH0KICB9CgogIHN3YXAoJmFycltpICsgMV0sICZhcnJbaGldKTsKCiAgcmV0dXJuIGkgKyAxOwp9Cgp2b2lkIHF1aWNrc29ydChpbnQgKmFyciwgaW50IGxvLCBpbnQgaGkpIHsKICBpZiAobG8gPCBoaSkgewogICAgaW50IHBpID0gcGFydGl0aW9uKGFyciwgbG8sIGhpKTsKCiAgICBxdWlja3NvcnQoYXJyLCBsbywgcGkgLSAxKTsKICAgIHF1aWNrc29ydChhcnIsIHBpICsgMSwgaGkpOwogIH0KfQoKaW50IG1haW4odm9pZCkgewogIGludCBjOwogIHNjYW5mKCIlZCIsICZjKTsKCiAgaW50IGFycltjXTsKICBmb3IgKGludCBpID0gMDsgaSA8IGM7IGkrKykgewogICAgc2NhbmYoIiVkIiwgJmFycltpXSk7CiAgfQoKICBxdWlja3NvcnQoYXJyLCAwLCBjIC0gMSk7CgogIHByaW50QXJyYXkoYXJyLCBzaXplb2YoYXJyKSAvIHNpemVvZihhcnJbMF0pKTsKCiAgcmV0dXJuIDA7Cn0KCi8vIEJFTE9XIElTIEJBU0lDIEZVTkNUSU9OUyBUTyBTV0FQIEFORCBQUklOVCBUSEUgQVJSQVkKCnZvaWQgc3dhcChpbnQgKmEsIGludCAqYikgewogIGludCB0ZW1wID0gKmE7CiAgKmEgPSAqYjsKICAqYiA9IHRlbXA7Cn0KCnZvaWQgcHJpbnRBcnJheShpbnQgKmFyciwgaW50IHNpemUpIHsKICBwcmludGYoIlNvcnRlZCBBcnJheTogXG4iKTsKCiAgZm9yIChpbnQgaSA9IDA7IGkgPCBzaXplOyBpKyspIHsKICAgIHByaW50ZigiJWQiLCBhcnJbaV0pOwoKICAgIGlmIChpICsgMSA8IHNpemUpIHsKICAgICAgcHJpbnRmKCIgIik7CiAgICB9CiAgfQp9