Binary search tree in Python
You can also consider a very elegant, recursive solution:

def insert(self, value, node=self.root):
   if node == null:
      return Node(value)
   if value &lt; node.value:
      node.left = self.insert(value, node.left)
   else
      node.right = self.insert(value, node.right)


Although, please mind that in case of large trees, efficiency of that solution is slightly lower (because of call stack)