Chat on IRC |
how to convert recursion to iteration
Posted by hkarshenas [send private reply] at June 11, 2002, 06:07:53 AM
Accept my best wishes
Could you please help me with this question. For example in Hanoy towers,how we can write it with the use of loops instead of recursion,or another one,the quick_sort in arrays. I am waiting for your answer. thank you
Posted by Psion [send private reply] at June 11, 2002, 09:11:34 AM
I'd love to answer, but this sounds like a homework question, and we don't want to do your homework for you. Is my suspicion correct?
Posted by unknown_lamer [send private reply] at June 11, 2002, 10:33:46 AM
The correct answer: you don't. Just make sure it is tail recursive and use Lisp instead! :)
Or, you could convert your recursion to tail recursion, and then it should be somewhat easier to create a loop out of that.
Posted by vikram_1982 [send private reply] at June 14, 2002, 11:52:57 AM
If I am not mistaken , the answer to ur question exists in a book called "Data Structures", by Bhagat Singh.
Register as a new user | ||||||