通过交换排序数组

I was studying quick sort and bubble sort and wondered if it is possible to sort the array by swapping any two elements and found this : https://www.geeksforgeeks.org/minimum-number-swaps-required-sort-array/

现在,我想知道每对交换是否分配了不同的成本。例如,在上面的链接中,每个掉期的成本均为1,因此总掉期=总成本。怎样解决这个问题?

评论