I have a number, K, and it is random, so I should have K partitions of one array
that they were find.
I have K-1 pivot, they are also random.
I must reorganize the array.
For example:
Array: 5 2 4 6 1 3
pivot: k-1=2 --> random Pivot 1: 4 and Pivot 2: 5
so I have 3 partitions.
I must use the Quicksort, and the Partition
void KQUICKSORT(int* list,int k,int p, int r)
{
int i=0;
if(p<r)
{
int *L = KPARTITION(list, k, p, r);
for(i=0;i<k;i++)
{
KQUICKSORT(list, k, L[i],L[i+1]-1);
}
}
}
I have to implement this code, but I don't have K partition... help me