changed the `copy_tree' algorithm to Xiaohu's beautiful one (lab10)