Efficient Array Storage for Binary Tree

后端 未结 5 808
暗喜
暗喜 2020-12-04 12:32

We have to write the nodes of a binary tree to a file. What is the most space efficient way of writing a binary tree . We can store it in array format with parent in positi

5条回答
  •  余生分开走
    2020-12-04 13:05

    You can save the in-order and pre/post-order traversal of the binary tree in the file and reconstruct the tree from these traversals.

提交回复
热议问题