Several enhancements and fixes

This commit is contained in:
krahets
2023-09-14 03:36:31 +08:00
parent a9d70e9e4b
commit d190dbf3c1
18 changed files with 84 additions and 70 deletions

View File

@ -62,9 +62,8 @@ class LinkedListDeque:
def pop(self, is_front: bool) -> int:
"""出队操作"""
# 若队列为空,直接返回 None
if self.is_empty():
return None
raise IndexError("双向队列为空")
# 队首出队操作
if is_front:
val: int = self.front.val # 暂存头节点值