Hello again everyone,
Here I come again with my stoopid questions
This time it is about recursion and iteration in code, as the name implies.
Having done some simple testing for various cases of sorting and manipulating variables otherwise, it seems that recursion is often faster than iteration with floats, while iteration has an edge with integers. At least that is what I got with gcc 3.3. Why is that?
On another note, I have heard that recursion generally is a bad choice if iteration would work as well, at least tail recursion. Is this just because of programming style and code readibility, or are there some other reasons for this?
Thanks for listening to my rambling and stay tuned for more stooopid question coming to a browser near you soon
Here I come again with my stoopid questions
Having done some simple testing for various cases of sorting and manipulating variables otherwise, it seems that recursion is often faster than iteration with floats, while iteration has an edge with integers. At least that is what I got with gcc 3.3. Why is that?
On another note, I have heard that recursion generally is a bad choice if iteration would work as well, at least tail recursion. Is this just because of programming style and code readibility, or are there some other reasons for this?
Thanks for listening to my rambling and stay tuned for more stooopid question coming to a browser near you soon