Driver Code
N = 12 NEW_LINE n = 10 NEW_LINE tree = [ [ ] for i in range ( n + 2 ) ] NEW_LINE tree [ 1 ] . append ( 3 ) NEW_LINE tree [ 3 ] . append ( 1 ) NEW_LINE tree [ 1 ] . append ( 6 ) NEW_LINE tree [ 6 ] . append ( 1 ) NEW_LINE tree [ 1 ] . append ( 2 ) NEW_LINE tree [ 2 ] . append ( 1 ) NEW_LINE tree [ 3 ] . append ( 4 ) NEW_LINE tree [ 4 ] . append ( 3 ) NEW_LINE tree [ 6 ] . append ( 8 ) NEW_LINE tree [ 8 ] . append ( 6 ) NEW_LINE tree [ 2 ] . append ( 7 ) NEW_LINE tree [ 7 ] . append ( 2 ) NEW_LINE tree [ 2 ] . append ( 5 ) NEW_LINE tree [ 5 ] . append ( 2 ) NEW_LINE tree [ 4 ] . append ( 9 ) NEW_LINE tree [ 9 ] . append ( 4 ) NEW_LINE tree [ 4 ] . append ( 10 ) NEW_LINE tree [ 10 ] . append ( 4 ) NEW_LINE print ( minEdge ( tree , n ) ) NEW_LINE