You are given a list of integers of size N.
Write an algorithm to sort the first K elements (from list[0] to list[K-1]) of the list in ascending order, and sort the remaining elements (from list[K] to list[N-1]) in descending order.
Print N space-separated integers representing the modified list.
8
11 7 5 10 46 23 16 8
3
5 7 11 46 23 16 10 8
First part:
11 7 5 → 5 7 11
Remaining part:
10 46 23 16 8 → 46 23 16 10 8
Hence, the final list is:
5 7 11 46 23 16 10 8
num ≤ inputList_size
Jefeeerirs • Pending
Jefeeerirs • Pending
Jefeeerirs • Pending
Texas • Pending