Sign in to follow this  

Cost of recursion

This topic is 2845 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I need to make a little script engineish program. Basically, I need to parse and handle multiple decision types ( if, for, while, etc ). These decisions can be nested within one another. In thinking about how to implement it, I've considered that I could call a function for each decision type. Three nested if's, therefore, would call the "if" function 3 times, recursively. Is there a better way to do this? How substantial will the hits from the additional call stack be, doing it recursively like this?

Share this post


Link to post
Share on other sites
How deeply nested ifs fors etc are you expecting?
20 would mean a monster-horror-killer structure, and that's only 20, it's negligible.
You have to consider storage/performance in flood-fill like situations (where there are branching, and the algorithm can fill thousands or millions of elements)

Share this post


Link to post
Share on other sites

This topic is 2845 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this