Serializing a Binary Tree

Design an algorithm and write code to serialize a binary tree. Discuss
various solutions

Answer:

Possible answer : Traverse the tree in inorder and store the numbers onto the disk.
then read the numbers and use the logic to create a binary tree from a sorted array.
Like this we will be creating a balanced tree when we deserialize the tree.

No comments: