Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is tail recursion optimization? [duplicate]

Possible Duplicate:
What is tail-recursion?

What is tail recursion optimization?

like image 766
JaredCacurak Avatar asked Sep 05 '26 11:09

JaredCacurak


1 Answers

a calls b calls c calls d.

at the end you have tails:

d returns to c returns to b returns to a. if all these do nothing (like in recursion, where it is actually a calls a calls a calls a) then you can optimize that... ...into d returns to a.

like image 181
TomTom Avatar answered Sep 07 '26 07:09

TomTom



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!