input: Write a python function to perform an in-order traversal of a binary search tree and return the elements in a list.
  assert in_order_traversal(build_tree([2, 6, 1, 4, 3, 5, 7])) == [1, 2, 3, 4, 5, 6, 7]
  assert in_order_traversal(build_tree([10, 5, 15, 3, 7, 12, 18])) == [3, 5, 7, 10, 12, 15, 18]
  assert in_order_traversal(build_tree([8, 3, 10, 1, 6, 9, 14])) == [1, 3, 6, 8, 9, 10, 14]
output: class TreeNode:
      def __init__(self, val=0, left=None, right=None):
          self.val = val
          self.left = left
          self.right = right
  
  def build_tree(nums):
      if not nums:
          return None
      
      def insert_into_bst(root, val):
          if not root:
              return TreeNode(val)
          if val < root.val:
              root.left = insert_into_bst(root.left, val)
          else:
              root.right = insert_into_bst(root.right, val)
          return root
      
      root = TreeNode(nums[0])
      for num in nums[1:]:
          insert_into_bst(root, num)
      return root
  
  def in_order_traversal(root):
      result = []
      
      def in_order(node):
          if node:
              in_order(node.left)
              result.append(node.val)
              in_order(node.right)
      
      in_order(root)
      return result