Repetition Through Iteration

  • Oliver Grillmeyer
Chapter
Part of the Undergraduate Texts in Computer Science book series (UTCS)

Abstract

Iteration is a type of repetition that, like recursion, involves repeating a task a certain number of times, or for every element in a list, or more generally until some condition is met. Iterative functions provide a means of carrying out these commonly performed tasks without having to explicitly create recursive functions. In general, any linear recursive function (a function with a single recursive call in each of its recursive cases) can be written using an iterative function. Most of the examples in this chapter are iterative versions of the functions written using recursion in Chapter 6. You should compare the iterative solutions to their recursive counterparts and decide which seems more natural to you.

Keywords

Outer Loop Nest Loop Recursive Call Company List Infinite Loop 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Copyright information

© Springer Science+Business Media New York 1998

Authors and Affiliations

  • Oliver Grillmeyer
    • 1
  1. 1.Department of Computer ScienceUniversity of California at BerkeleyBerkeleyUSA

Personalised recommendations