(self, root)
| 26 | return Tree |
| 27 | class Solution(object): |
| 28 | def inorderTraversal(self, root): |
| 29 | res, stack = [], [] |
| 30 | current = root |
| 31 | while True: |
| 32 | while current: |
| 33 | stack.append(current) |
| 34 | current = current.left |
| 35 | if len(stack) == 0: |
| 36 | return res |
| 37 | node = stack[-1] |
| 38 | stack.pop(len(stack)-1) |
| 39 | if node.data != None: |
| 40 | res.append(node.data) |
| 41 | current = node.right |
| 42 | return res |
| 43 | ob1 = Solution() |
| 44 | root = make_tree([10,5,15,2,7,None,20]) |
| 45 | print(ob1.inorderTraversal(root)) |
no test coverage detected