• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

something to put numbers in order...

Semidevil

Diamond Member
I"m doing my homework, and it surely is a pain in the A$$, when given like 20 random data, I need to put them in order manaully.

Is there a way for the computer to do it? excel? another program?
 
void quickSort(int numbers[], int array_size)
{
q_sort(numbers, 0, array_size - 1);
}


void q_sort(int numbers[], int left, int right)
{
int pivot, l_hold, r_hold;

l_hold = left;
r_hold = right;
pivot = numbers
;
while (left < right)
{
while ((numbers
>= pivot) && (left < right))
right--;
if (left != right)
{
numbers
= numbers
;
left++;
}
while ((numbers
<= pivot) && (left < right))
left++;
if (left != right)
{
numbers
= numbers
;
right--;
}
}
numbers
= pivot;
pivot = left;
left = l_hold;
right = r_hold;
if (left < pivot)
q_sort(numbers, left, pivot-1);
if (right > pivot)
q_sort(numbers, pivot+1, right);
}​
 
Back
Top