[Python] PreOrder Traversal - Clean & Concise - O(N)
Same with problem: 297. Serialize and Deserialize Binary Tree\n\npython\nclass Codec:\n    def serialize(self, root):\n        if root == None:\n            ret
Same with problem: [297. Serialize and Deserialize Binary Tree](https://leetcode.com/problems/serialize-and-deserialize-binary-tree/)\n\n```python\nclass Codec:\n    def serialize(self, root):\n        if root == None:\n            return "$"\n        return str(root.val) + "," + self.serialize(root.left) + "," + self.serialize(root.right)\n\n    def deserialize(self, data):\n        nodes = data.split(",")\n        self.i = 0\n        def dfs():\n            if self.i == len(nodes) or nodes[self.i] == "$":\n                self.i += 1\n                return None\n            root = TreeNode(int(nodes[self.i]))\n            self.i += 1\n            root.left = dfs()\n            root.right = dfs()\n            return root\n        \n        return dfs()\n```\n**Complexity**\n- Time & Space: `O(N)`, where `N` is number of nodes in BST.
[]