public int nextIndex ( int weight ) { if ( used == parent . length ) { int nsize = used + ( used >> 1 ) ; this . weight = Arrays . copyOf ( this . weight , nsize ) ; this . parent = Arrays . copyOf ( this . parent , nsize ) ; } this . weight [ used ] = weight ; this . parent [ used ] = used ; return used ++ ; }
Occupy the next unused index .