Assuming I understood the problem correctly, here it is:
 
Declare limit[], which is { 4, 3, 4, 3, 5, 10, etc ... }, and also idx[] with the same number of elements as limit[].
 
process(currLevel)
   if (currLevel == limit.size) then
     process your stuff here ... all the current indices for each level are in idx[]
     return
   end if
 
   for (i = 0; i < limit[currLevel]; i++) do
     idx[currLevel] = i
     go(currLevel + 1)
   end for
end procedure process
 
On 8/8/06, so.intech <[EMAIL PROTECTED]> wrote:

for example,
ret = 0;
for(i=0; i<3; i ++;)
{
for(j=0; j<4; j++;)
  {
      for(k=0; k<3; k++;)
      {
         for(m=0; m<4; m++;)
         {
             . . . //lots of groups <3 , <4 nested loops
                   ret ++;
         }
      }
   }
}

how can i write a recursive function to implement this?



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to