private void percolateDown ( int pos ) { int p = pos ; int y = this . heap . get ( p ) ; while ( left ( p ) < this . heap . size ( ) ) { int child = right ( p ) < this . heap . size ( ) && this . s . lt ( this . heap . get ( right ( p ) ) , this . heap . get ( left ( p ) ) ) ? right ( p ) : left ( p ) ; if ( ! this . s . lt ( this . heap . get ( child ) , y ) ) break ; this . heap . set ( p , this . heap . get ( child ) ) ; this . indices . set ( this . heap . get ( p ) , p ) ; p = child ; } this . heap . set ( p , y ) ; this . indices . set ( y , p ) ; }
Bubbles a element at a given position down .