in reply to Re^7: Recursion problem
in thread Recursion problem
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^9: Recursion problem
by BrowserUk (Patriarch) on May 26, 2008 at 08:57 UTC | |
It was pointed out that I may have misunderstood your concerns with my first reply. That you were probably alluding to the fact that the code I offered the OP only detects the first possible matching sequence, rather than returning all possible sequences. I attempted to offer the OP a starting point from which to understand how to develop recursive solutions, rather than just hand him a complete solution on a plate. That starting point can easily be extended to return the numbers involved in the (first) sequence detected:
And that can be extended to produce all sequences as follows:
Each is a logical progression of the preceeding. Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] [select] |
by ysth (Canon) on May 26, 2008 at 17:31 UTC | |
| [reply] |
|
Re^9: Recursion problem
by BrowserUk (Patriarch) on May 25, 2008 at 21:31 UTC | |
All, except the empty set case. Eventually you might need to investigate further to see if one such set was consistant with other information--order and delivery notes etc.--but initially, just whether any such (non-empty) set existed might be a useful boolean. But it would be rendered meaningless if the empty set is considered a match. In truth, it was just the first example I thought of that supported my argument. However, hard as I might try, I cannot think of a counter example. Not one. Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] |