2080 5

CSC211 ยท 2080 ยท 5 marks

Explain tail recursion with example. Compare recursion with iteration.

Explain tail recursion with example. Compare recursion with iteration. [5]

Data Structures and AlgorithmsChapter 4: RecursionPrinciple of Recursion, Comparison between Recursion and Ite

--- Tail recursion is a special form of recursion where the recursive call is the last operation performed in the function. That is, after the recursive call returns, there is nothing left to do in the calling function. Because of this property, the compiler or interpreter can optimize tail-recur...