Here is the updated and neatly typed code. I'm not sure what is missing or what is correct.
KT927
void Swap (float&x, float&y)
{
float temp;
temp = x;
x = y;
y = temp;
}
int Partition(float kArray[], int first, int last)
{
float Pivot = kArray[first];
int left = first;
int right = last;
while(left<right)
{
while (kArray
KT927
void Swap (float&x, float&y)
{
float temp;
temp = x;
x = y;
y = temp;
}
int Partition(float kArray[], int first, int last)
{
float Pivot = kArray[first];
int left = first;
int right = last;
while(left<right)
{
while (kArray
>Pivot)
{
right = right -1;
while((kArray
{
right = right -1;
while((kArray
<=Pivot) && (left<right))
{
left=left+1;
Swap(kArray
{
left=left+1;
Swap(kArray
, kArray
);
}
Swap(kArray[Pivot], kArray
}
Swap(kArray[Pivot], kArray
);
}
return right;
}
}
void Quicksort(float kArray[], int first, int last)
{
int PivotIndex;
if (first < last)
{
PivotIndex = Partition(kArray, first, last);
Quicksort(kArray, first, PivotIndex-1);
Quicksort(kArray, PivotIndex+1, last);
}
}
[sig][/sig]
}
return right;
}
}
void Quicksort(float kArray[], int first, int last)
{
int PivotIndex;
if (first < last)
{
PivotIndex = Partition(kArray, first, last);
Quicksort(kArray, first, PivotIndex-1);
Quicksort(kArray, PivotIndex+1, last);
}
}
[sig][/sig]