Skip to content

Commit 08e7789

Browse files
committed
Update class
1 parent b983690 commit 08e7789

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Python/_DATATYPES.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@
22

33
#Definition for a binary tree node.
44
class TreeNode:
5+
inOrder = []
56
def __init__(self, x):
67
self.val = x
78
self.left = None
89
self.right = None
910
def __str__(self):
1011
return str(self.val)
12+
def printInOrder(self, r):
13+
if r.left: r.printInOrder(r.left)
14+
self.inOrder += [r.val]
15+
if r.right: r.printInOrder(r.right)
16+
return self.inOrder
17+
1118

1219
# Definition for singly-linked list.
1320
class ListNode:
231 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)