mirror of
https://github.com/krahets/hello-algo.git
synced 2026-04-01 17:53:18 +08:00
Modify the exception handling in Java and Python.
This commit is contained in:
@@ -90,7 +90,7 @@ class MaxHeap {
|
||||
public int pop() {
|
||||
// 判空处理
|
||||
if (isEmpty())
|
||||
throw new EmptyStackException();
|
||||
throw new IndexOutOfBoundsException();
|
||||
// 交换根节点与最右叶节点(即交换首元素与尾元素)
|
||||
swap(0, size() - 1);
|
||||
// 删除节点
|
||||
|
||||
Reference in New Issue
Block a user