Create a balanced (not BST) tree
Hi, I would like to learn an algorithm to create a balanced tree.
I don't mean a Binary Search Tree (lowerThanRoot values go to left, HigherThanRoot go to right), I just want the tree to fill completely. Before creating a new level in the tree, all the nodes of the current level must be filled.
I've been trying to do it, but it seems more complex than i tought.
I've tought about using a queue data structure, filling it with visited nodes of the same level and then visit all their discendents when needed. Is it right?
If you got an algorithm for it (or better ideas, always appreciated), I'd like to take a look at it.
Thank you, Bye!