text: Function returns the minimum number of swaps required to sort the array This method is taken from below post www . geeksforgeeks . org / minimum - number - swaps - required - sort - array / https :
code: int minSwapsToSort ( int arr [ ] , int n ) {