DDropbox·DSASDE-2Onsite – Coding 1
Serialize and Deserialize a Binary Tree
Problem
Design algorithms to serialize a binary tree to a string and deserialize it back.
Example
[1,2,3,null,null,4,5] -> string -> tree
Constraints
- Up to 10^4 nodes
Approach
Preorder with null markers, or level-order. Discuss the format trade-offs.
added 6 days ago