Print 2 | Function to print the coordinates along with their frequency in ascending order ; map to store the pairs and their frequencies ; Store the coordinates along with their frequencies ; Driver code
def Print ( x , y , n ) : NEW_LINE INDENT m = dict ( ) NEW_LINE for i in range ( n ) : NEW_LINE INDENT m [ ( x [ i ] , y [ i ] ) ] = m . get ( ( x [ i ] , y [ i ] ) , 0 ) + 1 NEW_LINE DEDENT e = sorted ( m ) NEW_LINE for i in e : NEW_LINE INDENT print ( i [ 0 ] , i [ 1 ] , m [ i ] ) NEW_LINE DEDENT DEDENT x = [ 1 , 2 , 1 , 1 , 1 ] NEW_LINE y = [ 1 , 1 , 3 , 1 , 3 ] NEW_LINE n = len ( x ) NEW_LINE Print ( x , y , n ) NEW_LINE