#C13767. Descending QuickSort using Last Element as Pivot
Descending QuickSort using Last Element as Pivot
Descending QuickSort using Last Element as Pivot
Given an array of integers, implement the QuickSort algorithm to sort the array in descending order. In this problem, you must use the last element of the current segment as the pivot, i.e. if the array is \(a_1, a_2, \ldots, a_n\), you should choose \(a_n\) as the pivot.
The algorithm should be implemented recursively. The result must be read from stdin and printed to stdout as a list of space-separated integers on a single line.
inputFormat
The first line of input contains an integer \(n\) representing the number of elements in the array. The second line contains \(n\) space-separated integers.
outputFormat
Output the sorted array in descending order on a single line, with each element separated by a space.
## sample7
3 6 8 10 1 2 1
10 8 6 3 2 1 1