Create kd_buildtree