Could not insert elements into Binary Search Tree in Python -


class node:     def __init__(self,key):       self.left=none       self.right=none       self.val=key def insert(root,key):      if root none:         root=node(key)      else:         if root.val < key:             insert(root.right, key)      else:             insert(root.left, key)       def inorder(root):             if root:                 inorder(root.right)                 print root.val                 inorder(root.left)      root=none      d=input()      while(d!=-1):         insert(root,d)         d=input()      inorder(root) 

i not print above tree elements inorder.....what wrong code....can explain?


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -