Simple algorithm for ordering an array is switching and solving for example the largest first, then second largest and so on. You basically work say from top to bottom and always compare current element to the one in the top and switch if current element is larger that the one in the top. Now that we got the largest element on top we do same but leave the top element as is and sort the array without the top element i.e. compare everything to the second element and switch if current element is larger than the second element in the array and then without two elements on the top and so on. Here is an example for you.
1 2 3 4 5 6 7 8 9 10
int a[ N ], temp;
for( int pos = 0; pos < N - 1; pos++ )
for( int e = pos + 1; e < N; e++ )
if( a[ pos ] < a[ e ] )
{
temp = a[ e ];
a[ e ] = a[ pos ];
a[ pos ] = temp;
}
Notice that ascending and descending order have no difference in an algorithmical way: you get both orders in the same array, descending order is just from the first element to last and ascending from last to first element. Well obviously you could turn the algorithm around so that you would get ascending from first to last if you replaced < with >.