Sorting algorithms/Counting sort: Difference between revisions

→‎{{header|C}}: I changed the function called counting_sort() which actually finds the minimum and maximum elements in the array and does nothing with them.
(→‎{{header|Fortran}}: at that time Z is not have right value)
(→‎{{header|C}}: I changed the function called counting_sort() which actually finds the minimum and maximum elements in the array and does nothing with them.)
Line 235:
}
 
void counting_sortmin_max(int *array, int n, int *min, int *max)
{
int i, min, max;
*min = *max = array[0];
for(i=1; i < n; i++) {
if ( array[i] < *min ) {
*min = array[i];
} else if ( array[i] > *max ) {
*max = array[i];
}
}
Anonymous user