Open drashtipatel2503 opened 3 years ago
i want to solve this issue, as i learnt python and having the skill of doing problem-solving in python.
class Node: def init(self, key): self.left = None self.right = None self.val = key
def printInorder(root):
if root:
printInorder(root.left)
print(root.val),
printInorder(root.right)
def printPostorder(root):
if root:
printPostorder(root.left)
printPostorder(root.right)
print(root.val),
def printPreorder(root):
if root:
print(root.val),
printPreorder(root.left)
printPreorder(root.right)
root = Node(1) root.left = Node(2) root.right = Node(3) root.left.left = Node(4) root.left.right = Node(5) print "Preorder traversal of binary tree is" printPreorder(root)
print "\nInorder traversal of binary tree is" printInorder(root)
print "\nPostorder traversal of binary tree is" printPostorder(root)
can i work on this issue
Please assign me this issue
please assign me this issue
will add inorder, preorder, postorder and level order traversal in python