Driven Program
public static void main ( String args [ ] ) { int n = 10 ; for ( int i = 0 ; i < n + 2 ; i ++ ) tree . add ( new Vector < Integer > ( ) ) ; tree . get ( 1 ) . add ( 3 ) ; tree . get ( 3 ) . add ( 1 ) ; tree . get ( 1 ) . add ( 6 ) ; tree . get ( 6 ) . add ( 1 ) ; tree . get ( 1 ) . add ( 2 ) ; tree . get ( 2 ) . add ( 1 ) ; tree . get ( 3 ) . add ( 4 ) ; tree . get ( 4 ) . add ( 3 ) ; tree . get ( 6 ) . add ( 8 ) ; tree . get ( 8 ) . add ( 6 ) ; tree . get ( 2 ) . add ( 7 ) ; tree . get ( 7 ) . add ( 2 ) ; tree . get ( 2 ) . add ( 5 ) ; tree . get ( 5 ) . add ( 2 ) ; tree . get ( 4 ) . add ( 9 ) ; tree . get ( 9 ) . add ( 4 ) ; tree . get ( 4 ) . add ( 10 ) ; tree . get ( 10 ) . add ( 4 ) ; System . out . println ( minEdge ( n ) ) ; } }