Initialising lca values with - 1 Initialising MinWeight values with int . MaxValue Initialising MaxWeight values with int . MinValue
for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = 0 ; j < log ; j ++ ) { lca [ i , j ] = - 1 ; minWeight [ i , j ] = int . MaxValue ; maxWeight [ i , j ] = int . MinValue ; } }