title: Binary Search tree recursive implementation in python
body: <p>I'm trying to implement Binary Search tree in python using recursion. I got trapped in some infinite recursions happening in my program.I'm making recursive calls to the function <strong>RecursBST</strong> by passing address and the data until the top traverse down to None value of either it's left or right child.</p>
  
  <pre><code>class createnode:
      def __init__(self,data):
          self.root=data
          self.left=None
          self.right=None
  
  class createbinarysearchtree:
      def __init__(self, data = None):
          self.top=None   
  
      def RecursBST(self,top,data):            
          if self.top is None:
              self.top=createnode(data)                
          elif  self.top.root&gt;data:
              self.top.left=self.RecursBST(self.top.left,data)
          elif  self.top.root&lt;data:
              self.top.right=self.RecursBST(self.top.right,data)
  
  conv=createbinarysearchtree();
  conv.RecursBST(conv.top,50)
  conv.RecursBST(conv.top,40)
  </code></pre>
  
  <p>I ran to the below error :</p>
  
  <pre><code> self.top.left=self.RecursBST(self.top.left,data)
  RuntimeError: maximum recursion depth exceeded
  </code></pre>