mirror of
https://github.com/krahets/hello-algo.git
synced 2026-04-05 11:41:22 +08:00
build
This commit is contained in:
@@ -408,7 +408,7 @@ The implementation code is as follows:
|
||||
|
||||
def is_empty(self) -> bool:
|
||||
"""判断双向队列是否为空"""
|
||||
return self.size() == 0
|
||||
return self._size == 0
|
||||
|
||||
def push(self, num: int, is_front: bool):
|
||||
"""入队操作"""
|
||||
|
||||
@@ -368,7 +368,7 @@ Below is the code for implementing a queue using a linked list:
|
||||
|
||||
def is_empty(self) -> bool:
|
||||
"""判断队列是否为空"""
|
||||
return not self._front
|
||||
return self._size == 0
|
||||
|
||||
def push(self, num: int):
|
||||
"""入队"""
|
||||
|
||||
@@ -365,7 +365,7 @@ Below is an example code for implementing a stack based on a linked list:
|
||||
|
||||
def is_empty(self) -> bool:
|
||||
"""判断栈是否为空"""
|
||||
return not self._peek
|
||||
return self._size == 0
|
||||
|
||||
def push(self, val: int):
|
||||
"""入栈"""
|
||||
@@ -1237,7 +1237,7 @@ Since the elements to be pushed onto the stack may continuously increase, we can
|
||||
|
||||
def is_empty(self) -> bool:
|
||||
"""判断栈是否为空"""
|
||||
return self._stack == []
|
||||
return self._size == 0
|
||||
|
||||
def push(self, item: int):
|
||||
"""入栈"""
|
||||
|
||||
Reference in New Issue
Block a user