Re: Towers of Hanoi
- From: Bruce Lewis <brlspam@xxxxxxxxx>
- Date: 19 Jan 2006 08:51:18 -0500
"H." <hbe123@xxxxxxxxx> writes:
> Since both can be used in this problem (either a base case of 0 or a
> base case of 1), is one preferred over the other? If so, why?
When you're getting an understanding of the problem I think a base case
of 1 works better, because thinking about moving a 0-size tower out of
the way won't help you with the recursion.
Once you understand the problem and write a solution with the base case
of 1, changing the base case to 0 might make it more concise or
elegant. I don't know; I haven't solved it myself.
--
http://ourdoings.com/ Easily organize and disseminate news and
photos for your family or group.
.
- References:
- Towers of Hanoi
- From: H.
- Re: Towers of Hanoi
- From: Bruce Lewis
- Re: Towers of Hanoi
- From: H.
- Re: Towers of Hanoi
- From: Brian Harvey
- Re: Towers of Hanoi
- From: H.
- Towers of Hanoi
- Prev by Date: Re: built-in function for range?
- Next by Date: Re: built-in function for range?
- Previous by thread: Re: Towers of Hanoi
- Next by thread: Re: Towers of Hanoi
- Index(es):
Relevant Pages
|