human
Minimum swaps to make two arrays identical | Function returns the minimum number of swaps required to sort the array This method is taken from below post https : www . geeksforgeeks . org / minimum - number - swaps - required - sort - array /.
Create an array of pairs where first element is array element and second element is position of first element.
Sort the array by array element values to get right position of every element as second element of pair ..
To keep track of visited elements . Initialize all elements as not visited or false ..
Initialize result.
Traverse array elements.
Already swapped and corrected or already present at correct pos.
Find out the number of node in this cycle and add in ans.
Move to next node.
Update answer by adding current cycle ..
Return result.
Method returns minimum number of swap to mak array B same as array A.
map to store position of elements in array B we basically store element to index mapping ..
now we 're storing position  of array A elements  in array B..
Returing minimum swap for sorting in modified array B as final answer.
Driver code"
Solution in Python:

=====
What is a code to minimum swaps to make two arrays identical and the other steps required?
assistant
#Here is code to minimum swaps to make two arrays identical and the other steps required.
 def minSwapsToSort ( arr , n ) :
	arrPos = [ [ 0 for x in range ( 2 ) ] for y in range ( n ) ]
	for i in range ( n ) :
		arrPos [ i ] [ 0 ] = arr [ i ]
		arrPos [ i ] [ 1 ] = i
	arrPos . sort ( )
	vis = [ False ] * ( n )
	ans = 0
	for i in range ( n ) :
		if ( vis [ i ] or arrPos [ i ] [ 1 ] == i ) :
			continue
		cycle_size = 0
		j = i
		while ( not vis [ j ] ) :
			vis [ j ] = 1
			j = arrPos [ j ] [ 1 ]
			cycle_size += 1
		ans += ( cycle_size - 1 )
	return ans
def minSwapToMakeArraySame ( a , b , n ) :
	mp = { }
	for i in range ( n ) :
		mp [ b [ i ] ] = i
	for i in range ( n ) :
		b [ i ] = mp [ a [ i ] ]
	return minSwapsToSort ( b , n )
if __name__ == " _ _ main _ _ " :
	a = [ 3 , 6 , 4 , 8 ]
	b = [ 4 , 6 , 8 , 3 ]
	n = len ( a )
	print ( minSwapToMakeArraySame ( a , b , n ) )