Notifications
Clear all

[Closed] Getting the Parent Root of a hierarchy

no doubt… i have tools where i use a recursive version of the function getRoot. why? because in the same tool i have another recursive functions which can’t be done without recursion. so what’s the difference? one function more, one less…

…and classic optimization problem is the removal of ‘tail recursion’.

You don’t need to maintain a stack of prior calling states if all you do is immediately return the results of the last recursive call that was made.

http://en.wikipedia.org/wiki/Tail_call

Page 2 / 2