Design an algorithm to serialize and deserialize a binary tree.
Serialization is the process of converting a tree into a string. Deserialization is the reverse process.
Input:
[1,2,3,null,null,4,5]
Output: [1,2,3,null,null,4,5]
Input:
[]
Output: []
Your program must print the deserialized tree again as a level-order JSON array.
No submissions yet.
Discuss BFS vs DFS serialization, null handling, and tree reconstruction.