The difference between head & tail recursion

QuestionsThe difference between head & tail recursion
sethbeckerman5 Staff asked 12 years ago

I'm trying to get the difference between these 2 recursive strategies.

The definition I was told is the following:

Tail Recursion: A call is tail-recursive if nothing has to be done after the call returns i.e. when the call returns, the returned value is immediately returned from the calling function

Head Recursion: A call is head-recursive when the first statement of the function is the recursive call.


View on Stack Overflow