Design an algorithm to serialize (convert to string) and deserialize (convert back) a binary tree. Use preorder traversal with null markers.
public class Codec {
public string Serialize(TreeNode root) {
// TODO: implement your solution here
return "";
}
public TreeNode Deserialize(string data) {
// TODO: implement your solution here
return null;
}
}root = [1,2,3,null,null,4,5][1,2,3,null,null,4,5]