First find the largest element in the array and exchange it with the element in
the last position, then
find the second largest element in array and exchange it with the element in the second last position,
and continue in this
way until the entire array is sorted.