Skip to content

Commit d9209e5

Browse files
committed
fix: pop()
1 parent b2e8114 commit d9209e5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/dataStructures/queue/MonotonicQueue.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ public T max() {
6161
* Removal will only be done all representation of the object has been accounted for.
6262
*/
6363
public T pop() {
64+
if (dq.isEmpty()) {
65+
return null;
66+
}
6467
Pair<T> node = dq.peek();
6568
if (node.countDeleted > 0) {
6669
node.countDeleted -= 1;

0 commit comments

Comments
 (0)