Esse commit está contido em:
Bensouda Idriss 2023-03-28 18:15:31 +02:00
commit 912b726b4d
2 arquivos alterados com 11 adições e 1 exclusões

Ver arquivo

@ -136,8 +136,18 @@ public class BinaryHeap<E extends Comparable<E>> implements PriorityQueue<E> {
} }
@Override @Override
// on est
public void remove(E x) throws ElementNotFoundException { public void remove(E x) throws ElementNotFoundException {
// TODO: ArrayList<E> temp = new ArrayList<E>();
for (E e : array){
if (e != x){
temp.add(e);
}
}
for (int i=array.indexOf(x);i<array.size()-1;i++){
array.set(i, temp.get(i-1));
}
} }
@Override @Override