Serialize and Deserialize Binary Tree
=====================================================
Problem Description
Given a binary tree, design an algorithm to serialize and deserialize the tree. The serialization should be such that we can reconstruct the complete binary tree from the serialized string.
Rules and Constraints
- The serialization of a binary tree is the result of in-order traversal of its nodes, where the null node should be represented by "X" (null is represented by "X", while numbers are represented as strings).
- For deserialization, the tree can be reconstructed by using the serialized string to build the binary tree.
- The time complexity of serialization and deserialization should be O(N) respectively, where N is the number of nodes in the tree.
- The space complexity should be O(H) for serialization, where H is the height of the tree, and O(N) for deserialization.
Output Format
The serialization of the binary tree should be returned as a string. The deserialization function should return a TreeNode or null.
Example
Input: {"input_data":[1,2,3]}
Output: [1,2,3]