class Sort{
int i=0;
public int partition(int a[], int begin, int end){
int pivot, temp, L, R, t;
L = begin;
R = end;
pivot = (begin + end)/2;
System.out.printf("\n [퀵정렬 %d 단계 : pivot=%d ]\n", ++i, a[pivot]);
while(L<R){
while((a[L]<a[pivot]) && (L<R)) L++;
while((a[R]>=a[pivot]) && (L<R)) R--;
if(L<R){
temp = a[L];
a[L] = a[R];
a[R] = temp;
if(L == pivot){
for(t=0; t<a.length; t++)
System.out.printf("= ", a[t]);
System.out.println();
return R;
}
}
}
temp = a[pivot];
a[pivot] = a[R];
a[R] = temp;
for(t=0; t<a.length; t++)
System.out.printf("= ", a[t]);
System.out.println();
return L;
}
public void quickSort(int a[], int begin, int end){
if(begin < end){
int p;
p = partition(a, begin, end);
quickSort(a, begin, p-1);
quickSort(a, p+1, end);
}
}
}
c++임??
ㄴㄴ 자바임 c로 짠것도 있는데 c++로 짠거는 업어 c++은 짜야하는데 좀 걸림 필요함??
아 자바네 멍청멍청ㅋㅋ 그냥 궁금한거지 어케 짜는지
근데 나도 이거 배운지 몇개월 안되서 그러지 나도 몇년 지나면 까먹을듯 이거 배워도 쓸데가 없대
하 시발 저거 알고리즘 시험보는데 앞이 깜깜하다.