title: Create a Balanced Binary Search Tree with given a sorted list by passing the list to the sorting method in Python
body: <p>As the title says, my goal is to print the preorder of the Balanced Binary Search Tree given a sorted (ascending) list.
  The constraints are:</p>
  <ul>
  <li>sorted_array_to_bst() has to be a method of the TreeNode class</li>
  <li>the method takes as an argument the sorted list (not elements of the list iteratively)</li>
  </ul>
  <pre><code>class TreeNode(object):
      def __init__(self, x=None):
          self.val = x
          self.left = None
          self.right = None
  
      def sorted_array_to_bst(self, nums):
          def srt(nums):
              if not nums:
                  return None
              mid_num = len(nums) // 2
              if self.val is None:
                  self.val = nums[mid_num]
              # if self.val == nums[mid_num]:
              self.left = TreeNode(nums[:mid_num])
              self.right = TreeNode(nums[(mid_num + 1):])
          if self.val is None:
              srt(nums)
  
      def preorder(self, val):
          if self.val is not None:
              val.append(self.val)
          if self.left is not None:
              self.left.preorder(val)
          if self.right is not None:
              self.right.preorder(val)
          return val
  
  node = TreeNode()
  some_list = [1, 2, 3, 4, 5, 6, 7]
  node.sorted_array_to_bst(some_list)
  print(node.preorder([]))
  </code></pre>
  <p>for now the result is:
  <code>[4, [1, 2, 3], [5, 6, 7]]</code></p>
  <p>it should be:
  <code>[4, 2, 1, 3, 6, 5, 7]</code></p>
  <p>i tried sorting the left and right halves of the list:</p>
  <pre><code>            self.left = TreeNode(srt(nums[:mid_num]))
              self.right = TreeNode(srt(nums[(mid_num + 1):]))
  </code></pre>
  <p>but then the result is just <code>[4]</code></p>