initial assignmnet: g()={n1,..,nd)
inter(i)
{
if(i<0) return;
for(int j=0;j<g(i),j++)
{
do st
}
inter(i-1);
}
initial run: inter(d-1)
inter(i,j)
{
if(j==0)
{
if(i==0) return;
inter(i-1,g(i-1));
}
else
{
do st
inter(i,j-1);
}
}
initial run: inter(d-1,g(0))
inter()
{
for(int i=0 ; i<g(0);i++)
{
do st
}
.....//d times loop for
}
May it satisfy your think?
On Mon, Feb 1, 2010 at 11:56 AM, DMX <[email protected]> wrote:
> Can you please help me with this one.
>
> write two algorithms that iterate over every index from (0,0,......,0)
> to (n1,n2,......,nd).Make one algorithm recursive and the other
> iterative.
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.