AS I understand, there must be a stopping condition in recursive
functions.
suppose my function is like this -
void build_kdtree(kd node *kd, int axis, int depth)
{
if(kd->maxspheres <= MINSPHERES || depth >= DEPTHLIMIT)
{
kd->left = kd->right = NULL;
}
else
{
,,,,,,,,
build_kdtree(kd->left, axis, depth+1);
build_kdtree(kd->right, axis, depth+1);
}
My question is -
1. Is the stopping condition in if sufficient or some return value is
also necessary
2. Is this a right way to build a recursive function ?
functions.
suppose my function is like this -
void build_kdtree(kd node *kd, int axis, int depth)
{
if(kd->maxspheres <= MINSPHERES || depth >= DEPTHLIMIT)
{
kd->left = kd->right = NULL;
}
else
{
,,,,,,,,
build_kdtree(kd->left, axis, depth+1);
build_kdtree(kd->right, axis, depth+1);
}
My question is -
1. Is the stopping condition in if sufficient or some return value is
also necessary
2. Is this a right way to build a recursive function ?
Comment