bubble_sort() descending

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
/*
bubble_sort descending
n - size of array, sort_array[] - integer's array
// name: Isakov Nikita
MISIS, 2014
*/
for (int i = 0; i < n; ++i)
for (int j = i + 1; j < n; ++j)
if ( sort_array[i] < sort_array[j] )
swap( sort_array[i], sort_array[j]);