serialization/deserialization of a binary tree(C++ code)
Leetcode Serialization/Deserialization of a Binary Tree
Design an algorithm and write code to serialize and deserialize a binary
tree. Writing the tree to a file is called ‘serialization’ and reading
back from the file to reconstruct the exact same binary tree is
‘deserialization’.
Assume we have a binary tree below:
_30_
/ \
1020
/ / \
50 45 35
Using pre-order traversal, the algorithm should write the following to a file:
No comments:
Post a Comment