[Quote=引用 9 楼 gbb21 的回复:]
It depends. Actually, some guys like manually manipulate a stack variable and use a "fake loop" to simulate recursive execution which won't be more efficient than direct recursive call. To prevent stack overflow, the most important thing is check your algorithm while not giving up the recursive.
By the way, the recursive way only waste CONSTANT or O(log(N)) time than loop way, which should not be the critical point of your efficiency.
[/Quote]
It depends. Actually, some guys like manually manipulate a stack variable and use a "fake loop" to simulate recursive execution which won't be more efficient than direct recursive call. To prevent stack overflow, the most important thing is check your algorithm while not giving up the recursive.
By the way, the recursive way only waste CONSTANT or O(log(N)) time than loop way, which should not be the critical point of your efficiency.