I would like to ask you a question if you have a little bit of time. I have the following table:
I need to write a program that determines how many rows I have that start with 1, how many that start with 1,2 how many start with 1,2,3; 1,2,4;.....; 1,3,4;....; 2,2; 2,2,3 .... etc. etc. In other works I need to know all these possible combinations. I think this can be done iteratively with a bunch of for loops but it is a bit non-elegant. I have heard that recursive method is a little better. I have a book that talks about a simple recursive method (so I know what it is in theory) but I cannot get it to work on this table splitting. I guess I don't know whow to start. Do you think you would be able to help me to get going with this approach? Or maybe you'll convince me that recursive method is not the way to go.
I'd be hugely thankful to you! -Eric
To do this you will have to call the function with say 1 through 10 in each subroutine. When you have made ten calls deep you must return everytime or it will recurse forever.
Although, I do not know why you would choose that method. It took me some time to think up and will probably take exponentially more time to understand if you run into a glitch.
Just using two nestled loops would be more intuitive and more understandable and debugable.