 <p>Well, there are <code>splay trees</code> and <code>AVL Trees</code> that does what you are asking for but those are limited to a max of 2 children per node. You could try modifying them. The problem could be <code>Form a tree which is as wide as possible</code>.</p>