pop method
Remove and return the largest element
Implementation
@override
T? pop() {
if (isEmpty) return null;
_swap(0, _heap.length - 1);
final T maxValue = _heap.removeLast();
if (!isEmpty) {
_heapifyDown(0);
}
return maxValue;
}
Remove and return the largest element
@override
T? pop() {
if (isEmpty) return null;
_swap(0, _heap.length - 1);
final T maxValue = _heap.removeLast();
if (!isEmpty) {
_heapifyDown(0);
}
return maxValue;
}