General information
Category:
Coding, syntax & commands
>As for performance, I can;t agree with what you siad. I ahve seen many times that a recursive solution is the fastest one. This is only true, though, when the problem is recursive in nature.
Ok. In this case, I will say it in a different way: I am very sure that whatever recursive solution you have,
for whatever problem, I can write a faster non-recursive solution. This doesn't mean the performance gain would
justify the non-recursive solution and it doesn't mean it would be better and it doesn't mean I would use it in
real programming. It means only that there is a faster non-recursive solution (even if the gain would be <1%...).
>For example traversing a directory tree. The problem is recursive, I must find all the enteries in a directory, and if one of those is a directory I must find all the enteries for that directory, and on and on.
This is a very good example for what I've said above. I agree that this is a recursive problem and most probably the
performance gain for the non-recursive solution would not justify the additional complexity.
>Recursive problem, recursive solution. Iterative problem, irterative solution.
Right!
Vlad
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only