Valik Posted October 1, 2005 Posted October 1, 2005 Nothing requires recursion. The difference between recursion and non-recursion is who manages the stack. In recursion, the language manages the stack* while in non-recursion the user manages it. It's possible to implement any recursive function using a non-recursive form; it just may be exceedingly complex to do so.* This is perhaps the reason my recursive implementation above is poor. The language is managing the stack but I am too (The number of elements). I also think mine is slow because I pass the same parameters by value over and over. However, that makes the design simpler. The whole point of recursion is convenience and writing more code to allow recursion than it would take to do so without it just doesn't make sense.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now