An array represents a binary tree like this :
1 / \ 2 3 \ / 4 5 / 6
so apart from the last level, any missing child nodes are represented as *. You need to find the set of unconnected nodes whose sum is maximum. Child-parent relationship means they are connected.
An array represents a binary tree like this :
is represented as : 1 2 3 * 4 5 * 6so apart from the last level, any missing child nodes are represented as *. You need to find the set of unconnected nodes whose sum is maximum. Child-parent relationship means they are connected.