human
How to check if two given sets are disjoint ? | This function prints all distinct elements.
Creates an empty hashset.
Traverse the first set and store its elements in hash.
Traverse the second set and check if any element of it is already in hash or not ..
Driver method to test above method"
Solution in Python:
 Can you provide a code to how to check if two given sets are disjoint?
assistant
#Here is code to how to check if two given sets are disjoint .
 def areDisjoint ( set1 , set2 , n1 , n2 ) :
	myset = set ( [ ] )
	for i in range ( n1 ) :
		myset . add ( set1 [ i ] )
	for i in range ( n2 ) :
		if ( set2 [ i ] in myset ) :
		return False
	return True
if __name__ == " _ _ main _ _ " :
	set1 = [ 10 , 5 , 3 , 4 , 6 ]
	set2 = [ 8 , 7 , 9 , 3 ]
	n1 = len ( set1 )
	n2 = len ( set2 )
	if ( areDisjoint ( set1 , set2 , n1 , n2 ) ) :
		print ( " Yes " )
	else :
		print ( " No " )