Skip to content

Commit d62e8e2

Browse files
travis cli build fail
1 parent 887f9e5 commit d62e8e2

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

traverals/binary_tree_traversals.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77

88
class TreeNode:
9-
109
def __init__(self, data):
1110
self.data = data
1211
self.right = None
@@ -49,26 +48,23 @@ def pre_order(node):
4948

5049

5150
def in_order(node):
52-
if not isinstance(node, TreeNode) or not node:
53-
print("Invalid input")
51+
if not isinstance(node, TreeNode) or not node:
5452
return
5553
in_order(node.left)
5654
print(node.data, end=" ")
5755
in_order(node.right)
5856

5957

6058
def post_order(node):
61-
if not isinstance(node, TreeNode) or not node:
62-
print("Invalid input")
59+
if not isinstance(node, TreeNode) or not node:
6360
return
6461
post_order(node.left)
6562
post_order(node.right)
6663
print(node.data, end=" ")
6764

6865

6966
def level_order(node):
70-
if not isinstance(node, TreeNode) or not node:
71-
print("Invalid input")
67+
if not isinstance(node, TreeNode) or not node:
7268
return
7369
q = queue.Queue()
7470
q.put(node)
@@ -83,6 +79,7 @@ def level_order(node):
8379

8480
if __name__ == '__main__':
8581
import sys
82+
8683
print("\n********* Binary Tree Traversals ************\n")
8784
# For python 2.x and 3.x compatibility: 3.x has not raw_input builtin
8885
# otherwise 2.x's input builtin function is too "smart"

0 commit comments

Comments
 (0)