1

An array has elements like a1,a2,a3...an with constraints 1 <= ai <= n.

I need to find minimum number of swaps required to sort an array in descending order.

I was able to get a solution with selection sort but it has a time complexity of O(n^2) but i need an efficient solution.

Please refer to the below link and help me to find it in the descending order. Compute the minimal number of swaps to order a sequence

Asclepius
  • 57,944
  • 17
  • 167
  • 143

0 Answers0