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 once had for an algorithms course --- I think it was to implement and analyse Strassen's algorithm.


My recursive algorithm would run out of stack space when the input matrices got too large. But I was programming in Java, and the JVM allows you to set the stack size.

So, by plotting input size when it crashes vs stack size, I was able to get a nice graph displaying the space complexity of the algorithm :-)

--
John.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to