Re: [Tutor] Re: Recursion....what are the best situations to use it?

2005-04-15 Thread John Fouhy
Andrei wrote: Recursion is dangerous if its depth is unchecked. I've recently seen a recursive quicksort implementation run wild for example, killing the program without any error message (not in Python, but the principle is the same regardless the programming language). I recall an assignment I on

[Tutor] re: recursion

2005-04-15 Thread jsoares
Thanks for all the replies to my "use of recursion" question. I now have six clear situations where recursion would be best. The consensus seems to be that if you have anything that might contain something underneath it(like a main menu with submenus), you have a good recursion candidate.Best,John[

[Tutor] Re: Recursion....what are the best situations to use it?

2005-04-14 Thread Andrei
Safe-mail.net> writes: > If this is too general a question, perhaps you can tell me when NOT to use recursion(where it would be > inappropriate or inefficient). Easy way to kill a Python program: >>> def a(): ... a() Recursion is dangerous if its depth is unchecked. I've recently seen a r

Re: [Tutor] Re: Recursion....what are the best situations to use it?

2005-04-14 Thread Lee Cullens
It is really more of a question of the type of problem and the solution approach in general. For example, one can find the intersection of two lines with a simple equation, but that equation depends on the dimension the lines are in (2D, 3D, ...). If one were working in 2D space only, the

Re: [Tutor] Re: Recursion....what are the best situations to use it?

2005-04-14 Thread Max Noel
On Apr 14, 2005, at 21:06, [EMAIL PROTECTED] wrote: I've seen a couple of nice tutorials on recursion, and a lot of awful ones. The latter always trot out the fibonacci and factorial examples for some reason. And that's about it! The good ones showed me how to trace through recursive calls and g

Re: [Tutor] Re: Recursion....what are the best situations to use it?

2005-04-14 Thread jfouhy
Quoting "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>: > If this is too general a question, perhaps you can tell me when NOT to > use recursion(where it would be inappropriate or inefficient). In my opinion --- Some problems are naturally recursive. A good example is traversing data structures (parti

Re: [Tutor] Re: Recursion....what are the best situations to use it?

2005-04-14 Thread Kent Johnson
[EMAIL PROTECTED] wrote: I've seen a couple of nice tutorials on recursion, and a lot of awful ones. The latter always trot out the fibonacci and factorial examples for some reason. And that's about it! The good ones showed me how to trace through recursive calls and gave me practical examples(t

Re: [Tutor] Re: Recursion....what are the best situations to use it?

2005-04-14 Thread Danny Yoo
> What I want to know is this: what are other specific situations where a > recursive algorithm would be better or easier to program than an > iterative one? Hello, Programs that have to deal with data often have an internal structure that mimics that data. A program that deals with lists looks

Re: [Tutor] Re: Recursion....what are the best situations to use it?

2005-04-14 Thread R. Alan Monroe
> I know that the Eight Queens puzzle is a good recursion candidate, > but I don't understand why as yet. I'm still on simple recursion, > and am just beginning to understand backtracking in a simple > example, like adding numbers in an array. If you make a typo when typing an email, do you delet

[Tutor] Re: Recursion....what are the best situations to use it?

2005-04-14 Thread jsoares
I've seen a couple of nice tutorials on recursion, and a lot of awful ones. The latter always trot out the fibonacci and factorial examples for some reason. And that's about it! The good ones showed me how to trace through recursive calls and gave me practical examples(tictactoe, magic squares, Tow