How to Simulate Recursive Functions Using Stack and While-loop to Avoid the Stack-overflow - CodeProject