update the format
This commit is contained in:
parent
1b72a42820
commit
ec18d6f301
@ -538,23 +538,23 @@ public TreeLinkNode GetNext(TreeLinkNode pNode) {
|
|||||||
|
|
||||||
```python
|
```python
|
||||||
def GetNext(self, pNode):
|
def GetNext(self, pNode):
|
||||||
# write code here
|
# write code here
|
||||||
# pNode is None
|
# pNode is None
|
||||||
if not pNode:
|
if not pNode:
|
||||||
return pNode
|
return pNode
|
||||||
if pNode.right:
|
if pNode.right:
|
||||||
node = pNode.right
|
node = pNode.right
|
||||||
while node.left:
|
while node.left:
|
||||||
node = node.left
|
node = node.left
|
||||||
return node
|
return node
|
||||||
else:
|
else:
|
||||||
while pNode.next:
|
while pNode.next:
|
||||||
parent = pNode.next
|
parent = pNode.next
|
||||||
if parent.left == pNode:
|
if parent.left == pNode:
|
||||||
return parent
|
return parent
|
||||||
pNode = pNode.next
|
pNode = pNode.next
|
||||||
# pNode not have the next node
|
# pNode not have the next node
|
||||||
return None
|
return None
|
||||||
```
|
```
|
||||||
# 9. 用两个栈实现队列
|
# 9. 用两个栈实现队列
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user