In university we were asked how we would save an incomplete binary tree into an array. The indices would be 2i+1 for the left child and 2i+2 for the right child of a Vertex. floor((i − 1)/2) for the parent node. The first question now was how we would represent the "missing" vertexes.
I think that could be accomplished just by saving "null" into the Array. Are there any better solutions?
The second question is the point where I clearly don't have any idea what to answer. It was asked why no one would actually do that and which severe problems can occur if we implement the problem from the first question like that.
Thanks for your help.