Re: Is this recursion?
- From: Gordon Beaton <n.o.t@xxxxxxxxx>
- Date: 30 Jan 2007 12:01:13 GMT
On 30 Jan 2007 02:19:33 -0800, Marion wrote:
I wrote a simple program that reverses a word that doesn't have a
base step but it calls itself. Would this be considered by the
formal defintion of recursion?
You claim that it works correctly, so I claim there is in fact a base
case (without which it would continue recursing forever).
In your code, you only recurse conditionally (when position != 0).
What happens otherwise? That's your base case.
/gordon
--
[ don't email me support questions or followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
.
- References:
- Is this recursion?
- From: Marion
- Is this recursion?
- Prev by Date: Re: Clicking on Sun Java Plugin installation evokes 3 basic java setup questions
- Next by Date: Re: Is this recursion?
- Previous by thread: Is this recursion?
- Next by thread: Re: Is this recursion?
- Index(es):