title: printing max depth in Binary search tree
body: <p>I am trying to obtain the max depth of a binary search tree however I believe the tree is counting wrong. </p>
  
  <p>my code:</p>
  
  <pre><code>    def BST_maxdepth(root):
          curdepth = [1]
          maxdepth = [1]
          if root is None:
              return -1
          else:
              curdepth[0] = 1
              maxdepth[0] = 1
              if root.left is not None or root.right is not None:
                  curdepth[0] += 1
                  if curdepth[0] &gt; maxdepth[0]:
                      maxdepth[0] = curdepth[0]
                  BST_maxdepth(root.left)
                  BST_maxdepth(root.right)
          return maxdepth[0]
  </code></pre>
  
  <p>classes &amp; BST:</p>
  
  <pre><code>class Node:
      def __init__(self,value):
          self.right = None
          self.left = None
          self.value = value
  
  
  def BST_Insert(root, node):     # root --&gt; root of tree or subtree!
      if root.value is None:
          root = node             # beginning of tree
      else:
          if root.value &gt; node.value:     # go to left
              if root.left is None:
                  root.left = node
              else:
                  BST_Insert(root.left, node)
  
          if root.value &lt; node.value:    # go to right
              if root.right is None:
                  root.right = node
              else:
                  BST_Insert(root.right, node)
  </code></pre>
  
  <p>tests:</p>
  
  <pre><code>r = Node(8)
  
  
  a = Node(5)
  b = Node(2)
  c = Node(1)
  d = Node(3)
  e = Node(7)
  </code></pre>
  
  <p>output:</p>
  
  <p><code>2</code></p>
  
  <p>expected output:</p>
  
  <p><code>4</code></p>