using one min-heap to build tree