NIST

collective recursion

(algorithmic technique)

Definition: A special form of tail recursion, where the results are produced during the recursive calls and nothing is returned. The recursion may be optimized away by executing the call in the current stack frame, rather than creating a new stack frame, or by deallocating the entire recursion stack at once rather than a little at each return.

Note: The following program prints the values greater than limit in a list.

 int overlimit(list l, int limit)
{
if (null == l) {
return;
}

if (limit < head(l)) {
printf("%d\n", head(l));
}
overlimit(tail(l), limit);
}
At the return, the compiler can deallocate all the memory for the recursion stack at once.

Author: PEB


Go to the Dictionary of Algorithms and Data Structures home page.

If you have suggestions, corrections, or comments, please get in touch with Paul Black.

Entry modified 14 August 2008.
HTML page formatted Mon Feb 2 13:10:39 2015.

Cite this as:
Paul E. Black, "collective recursion", in Dictionary of Algorithms and Data Structures [online], Vreda Pieterse and Paul E. Black, eds. 14 August 2008. (accessed TODAY) Available from: http://www.nist.gov/dads/HTML/collectiveRecursion.html