Swap pair of arr [ i ] with arr [ i + 1 ] and recursively compute minimum swap required if this move is made .
int one = arr [ i + 1 ] ; int indextwo = i + 1 ; int indexone = index [ pairs [ arr [ i ] ] ] ; int two = arr [ index [ pairs [ arr [ i ] ] ] ] ; swap ( arr [ i + 1 ] , arr [ indexone ] ) ; updateindex ( index , one , indexone , two , indextwo ) ; int a = minSwapsUtil ( arr , pairs , index , i + 2 , n ) ;