recursion.
- From: pereges <Broli00@xxxxxxxxx>
- Date: Wed, 9 Apr 2008 04:57:58 -0700 (PDT)
AS I understand, there must be a stopping condition in recursive
functions.
suppose my function is like this -
void build_kdtree(kdnode *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 ?
.
- Follow-Ups:
- Re: recursion.
- From: Chris Dollin
- Re: recursion.
- Prev by Date: Re: K&R2, exercise 5.4
- Next by Date: Re: K&R2, exercise 5.4
- Previous by thread: K&R2, exercise 5.4
- Next by thread: Re: recursion.
- Index(es):