human
Find Union and Intersection of two unsorted arrays | Function to find intersection.
when both are equal.
Driver Code.
sort.
function call"
How can the above be solved in Python?
assistant
#Here is code to find Union and Intersection of two unsorted arrays and the other steps required.
 def intersection ( a , b , n , m ) :
	i = 0
	j = 0
	while ( i < n and j < m ) :
		if ( a [ i ] > b [ j ] ) :
			j += 1
		else :
			if ( b [ j ] > a [ i ] ) :
				i += 1
			else :
				print ( a [ i ] , end = " ▁ " )
				i += 1
				j += 1
if __name__ == " _ _ main _ _ " :
	a = [ 1 , 3 , 2 , 3 , 4 , 5 , 5 , 6 ]
	b = [ 3 , 3 , 5 ]
	n = len ( a )
	m = len ( b )
	a . sort ( )
	b . sort ( )
	intersection ( a , b , n , m )