#include <stdio.h>
#include <stdlib.h>
int partition(int *a, int p, int q);
int q_sort(int *a, int p, int q);
int partition(int *a, int p, int q)
{
int primary = a[p];
int i, j;
int temp;
i = p;
j = p+1;
while(j<=q)
{
if(a[j] >= primary)
j++;
else
{
temp = a[i+1];
a[i+1] = a[j];
a[j] = temp;
++i;
++j;
}
}
temp = a[p];
a[p] = a[i];
a[i] = temp;
return i;
}
/