title: Efficient Array Storage for Binary Tree
body: <p>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 position <code>i</code> and its children in <code>2i</code>, <code>2i+1</code>. But this will waste lot of space in case of sparse binary trees.</p>