import java.util.Arrays;
import sk.upjs.paz.calltree.CallTree;
public class QuickSort extends TriediaciAlgoritmus {
static int[] q = new int[]{13,12,11,10,9,8,7};
//static int[] q = new int[]{1,3,2,5,7,6,4};
@Override
protected void utried(int dlzkaPola) {
// TODO Auto-generated method stub
quickSort(0, dlzkaPola-1);
System.out.println(pocetPorovnani);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] p = q;
QuickSort triediaciAlg = new QuickSort();
triediaciAlg.utried(p);
System.out.println(Arrays.toString(p));
}
public int rozdel(int odIdx, int poIdx) {
int pivot = poIdx;
int idx = odIdx;
for (int i = odIdx; i <= poIdx - 1; i++)
if (porovnaj(i,pivot)<0) {
vymen(i, idx);
idx++;
}
vymen(idx, poIdx);
return idx;
}
void quickSort(int odIdx, int poIdx) {
CallTree.markCall(odIdx,poIdx,Arrays.toString(q));
if (odIdx >= poIdx)
return;
int pivotIdx = rozdel(odIdx, poIdx);
quickSort(odIdx, pivotIdx - 1);
quickSort(pivotIdx + 1, poIdx);
}
}