I have come across an algorithm to calculate the minimum number of swaps to sort an array without duplicate elements. The case becomes interesting when there are duplicate elements in the array. Let us assume the array can contain integer elements ranging from -2^31 - (2^31)-1. Also, the array can contain repeated elements in it. Is there an efficient algorithm to find the minimum number of swaps needed to put this array into sorted order?
Note: I'm not actually trying to sort the array, rather to find out the minimum number of swaps that make it in ascending order. I'm not worried about the stability. Swaps can exchange any pair of elements (they need not be adjacent).