(int index)
| 31 | upheap(list.size() - 1); |
| 32 | } |
| 33 | private void upheap(int index) { |
| 34 | if(index == 0) { |
| 35 | return; |
| 36 | } |
| 37 | int p = parent(index); |
| 38 | if(list.get(index).compareTo(list.get(p)) < 0) { |
| 39 | swap(index, p); |
| 40 | upheap(p); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | public T remove() throws Exception { |
| 45 | if (list.isEmpty()) { |