Storing the level of each node
level [ node ] = h ; if ( parent != - 1 ) { minWeight [ node , 0 ] = Math . Min ( weight [ node ] , weight [ parent ] ) ; maxWeight [ node , 0 ] = Math . Max ( weight [ node ] , weight [ parent ] ) ; } for ( int i = 1 ; i < log ; i ++ ) { if ( lca [ node , i - 1 ] != - 1 ) {