Mi-séance 704, problèmes tests BH
This commit is contained in:
parent
c3d9577472
commit
aabddfa684
1 changed files with 7 additions and 1 deletions
|
@ -137,7 +137,13 @@ public class BinaryHeap<E extends Comparable<E>> implements PriorityQueue<E> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void remove(E x) throws ElementNotFoundException {
|
public void remove(E x) throws ElementNotFoundException {
|
||||||
// TODO:
|
int index=this.array.indexOf(x);
|
||||||
|
if (index<0)
|
||||||
|
throw new ElementNotFoundException(x);
|
||||||
|
|
||||||
|
this.array.set(index, this.array.get(this.array.size()-1));
|
||||||
|
this.currentSize--;
|
||||||
|
this.percolateDown(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue