# class TreeNode:
#     def __init__(self, x):
#         self.val = x
#         self.left = None
#         self.right = None

#
# 
# @param root TreeNode类 
# @return int整型一维数组
#
class Solution:
    def preorderTraversal(self , root ):
            if not root:
                return []
            return [root.val]+self.preorderTraversal(root.left)+self.preorderTraversal(root.right)