树形结构简化算法

tree height reduction algorithm