You can write serialization for leaf nodes, and then for parent nodes.
Recursive map: {value: [serialize(left), serialize(right)]}, where serialized leaf is null.
You can write serialization for leaf nodes, and then for parent nodes.
Recursive map: {value: [serialize(left), serialize(right)]}, where serialized leaf is null.