Functional Problem Solving (CSC 151 2013F) : Outlines

Outline 26: Recursion with Helper Procedures


Held: Monday, 14 October 2013

Back to Outline 25 - Pause for breath. On to Outline 27 - Other Forms of List Recursion.

Summary

We consider a different form of recursion, one based on the construction of recursive helpers that take additional parameters. Along the way, we consider the idea of tail recursion. We also explore how careless design of recursive procedures can inadvertently lead to slow execution.

Related Pages

Overview

Administrivia

Basics of Helper Recursion

Tail Recursion

Old Notes

These are from a previous time I taught the class. I leave them around for historical reasons.

=== Delayed Evalution in Recursive Procedures

=== Helper Recursion

  partial-sum            unexplored-elements
  0                      (2 3 5 7 11 13)
  2                      (3 5 7 11 13)
  5                      (5 7 11 13)
  8                      (7 11 13)
  15                     (11 13)
  26                     (13)
  39                     ()

Samuel A. Rebelsky, rebelsky@grinnell.edu

Copyright (c) 2007-2013 Janet Davis, Samuel A. Rebelsky, and Jerod Weinman. (Selected materials are copyright by John David Stone or Henry Walker and are used with permission.)

Creative Commons License

This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/3.0/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.