I see some times developers do not optimize recursive functions to put less load on stack although many times it can be done with some simple changes in the code without even affecting usability. Lets assume we have a recursive function like the following (which is a C# implementation of