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 :
int minSwapsToSort ( int arr [ ] , int n ) {