# Storing binary trees

Binary trees can be stored in an array as follows:

Indexing of the array starts at $$1$$ instead of $$0$$. For an array $$P$$, the root is stored at $$P[1]$$. For a node stored at $$P[i]$$, the left child, if any, is stored in $$P[2i]$$ and the right child, if any, in $$P[2i+1]$$.

What should be the minimum size of array $$P$$ to be able to store any binary tree of $$n$$ vertices?

×

Problem Loading...

Note Loading...

Set Loading...