퀵소트 비재귀 코드인데여 !!! 봐주세요 ㅠㅠㅠ
쥬디시어스
2023.04.01
퀵소트 비재귀 코드인데여 .. 실행시켜보고싶은데 ..메인부분이 없어서요 .. 코딩실력이 없어서 쫌도와주세요 !! ㅠㅠ#define MAX 12 /*MAX STACK*/
typedef struct node
{
int l, r;
}NODE;
void sort(int a[], int l, int r)
{
NODE stack[MAX];
int i, j, x, temp, top = -1;
stack[top].l = l; stack[top].r = r;
do
{
l = stack[top].l; r = stack[top--].r;
do
{
i = l; j = r; x = a[(l+r)/2];
do
{
while(a[i] x) i++;
while(a[j] x) j--;
if(i = j)
{
temp = a[i];
a[i] = a[j];
a[j] = temp;
i++;
j--;
}
}
while(i = j);
if(i r)
{
stack[++top].l = i;
stack[top].r = r;
}
r = j;
}
while(l r);
}
while(top != -1);
}