@SuppressWarnings("unchecked") protected void heapifyUpComparable(int pos,Object elem){
  final Comparable<Object> cur=(Comparable<Object>)elem;
  while (pos > 0) {
    final int parent=(pos - 1) >>> 1;
    Object par=queue[parent];
    if (cur.compareTo(par) >= 0) {
      break;
    }
    queue[pos]=par;
    pos=parent;
  }
  queue[pos]=cur;
}

@ SuppressWarnings ( "unchecked" ) protected void heapifyUpComparable ( int pos , Object elem ) { final Comparable < Object > cur = ( Comparable < Object > ) elem ; while ( pos > 0 ) { final int parent = ( pos - 1 ) > > > 1 ; Object par = queue [ parent ] ; if ( cur . compareTo ( par ) >= 0 ) { break ; } queue [ pos ] = par ; pos = parent ; } queue [ pos ] = cur ; }
execute a " heapify upwards " aka " siftup " . used in insertions .
