C++ Just preorder traversal which gives unique BST structure. No delimiter
Preorder uniquely determines stucture of a BST. Just construct a BST by feeding elements from a preorder array.\n2.  Used 4 chars per integer element by seriali
1.  Preorder uniquely determines stucture of a BST. Just construct a BST by feeding elements from a preorder array.\n2.  Used 4 chars per integer element by serializing  binary representation. No need of a delimiter while deserializing.\n3.  Complexity serializiation(preorder) : O(n)\n4.   Complexity dserializiation(constructing binary tree): O(nlogn) (average case)\n```\nclass Codec {\npublic:\n\n    // Encodes a tree to a single string.\n    void postOrder(TreeNode* root, string& res){\n        if(!root)\n            return;\n        vector<char> buf(sizeof(int), 0);\n        memcpy(buf.data(), &(root->val), sizeof(int));\n        for(auto c:buf)\n            res.push_back(c);\n        postOrder(root->left, res);\n        postOrder(root->right, res);\n        \n    }\n    string serialize(TreeNode* root) {\n        string res;\n        postOrder(root, res);\n        return res;\n    }\n\n    TreeNode* deserialize(int elem, TreeNode* root){\n        if(!root)\n            return new TreeNode(elem);\n        if(root->val >  elem)\n            root->left  = deserialize(elem, root->left);\n        else\n           root->right  = deserialize(elem, root->right); \n        return root;\n\n    }\n    // Decodes your encoded data to tree.\n    TreeNode* deserialize(string data) {\n        int i = 0;\n        TreeNode* root = nullptr;\n        while(i< data.size()){\n            int elem = 0;\n            memcpy(&elem, &data[i], sizeof(int));\n            i+=sizeof(int);\n            root = deserialize(elem, root);\n        }\n        return root;\n    }\n```
[]