re-organize binary tree