Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void percolateDown(int hole)
- {
- int child;
- T tmp = array[hole];
- for( ; d*(hole-1)+2 <= currentSize; hole = child )
- {
- child = d*(hole-1)+2;
- int smallest = 0;
- for(int i = 1; i < d; i++)
- if(child != currentSize && array[child+i].compareTo(array[child]) < 0)
- smallest = i;
- child += smallest;
- if(array[child].compareTo(tmp) < 0)
- array[hole] = array[child];
- else
- break;
- }
- array[hole] = tmp;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement