Prints intersection of arr1 [ 0. . n1 - 1 ] and arr2 [ 0. . n2 - 1 ]
void printIntersection ( int arr1 [ ] , int arr2 [ ] , int n1 , int n2 ) { set < int > hs ; for ( int i = 0 ; i < n1 ; i ++ ) hs . insert ( arr1 [ i ] ) ; for ( int i = 0 ; i < n2 ; i ++ ) if ( hs . find ( arr2 [ i ] ) != hs . end ( ) ) cout << arr2 [ i ] << " ▁ " ; }