I want to build a tree from the leaves to the root. I have a list that gives me the leaves in the order they must be in the bottom of the tree:
a->b->c->d->e->f->g
Buiding from the leaves to the root i want every inner node to have both a left and a right child .The inner nodes of the tree and the root will be empty nodes . Its possible to have a tree where some leaves are further from the root than others if the number of the leaves(items in list) is odd
What is the most efficient way to do it?