Driver Code
public static void Main ( String [ ] args ) { int n = 10 ; for ( int i = 0 ; i < n + 2 ; i ++ ) tree . Add ( new List < int > ( ) ) ; tree [ 1 ] . Add ( 3 ) ; tree [ 3 ] . Add ( 1 ) ; tree [ 1 ] . Add ( 6 ) ; tree [ 6 ] . Add ( 1 ) ; tree [ 1 ] . Add ( 2 ) ; tree [ 2 ] . Add ( 1 ) ; tree [ 3 ] . Add ( 4 ) ; tree [ 4 ] . Add ( 3 ) ; tree [ 6 ] . Add ( 8 ) ; tree [ 8 ] . Add ( 6 ) ; tree [ 2 ] . Add ( 7 ) ; tree [ 7 ] . Add ( 2 ) ; tree [ 2 ] . Add ( 5 ) ; tree [ 5 ] . Add ( 2 ) ; tree [ 4 ] . Add ( 9 ) ; tree [ 9 ] . Add ( 4 ) ; tree [ 4 ] . Add ( 10 ) ; tree [ 10 ] . Add ( 4 ) ; Console . WriteLine ( minEdge ( n ) ) ; } }