update the format

This commit is contained in:
haiker2011 2018-09-27 20:38:17 +08:00
parent 1b72a42820
commit ec18d6f301

View File

@ -538,23 +538,23 @@ public TreeLinkNode GetNext(TreeLinkNode pNode) {
```python
def GetNext(self, pNode):
# write code here
# pNode is None
if not pNode:
return pNode
if pNode.right:
node = pNode.right
while node.left:
node = node.left
return node
else:
while pNode.next:
parent = pNode.next
if parent.left == pNode:
return parent
pNode = pNode.next
# pNode not have the next node
return None
# write code here
# pNode is None
if not pNode:
return pNode
if pNode.right:
node = pNode.right
while node.left:
node = node.left
return node
else:
while pNode.next:
parent = pNode.next
if parent.left == pNode:
return parent
pNode = pNode.next
# pNode not have the next node
return None
```
# 9. 用两个栈实现队列