CS 135 (Module 9: Patterns of Recursion)

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/6

flashcard set

Earn XP

Last updated 11:32 PM on 11/7/22
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

7 Terms

1
New cards
In simple recursion, every argument in a recursive function application are either:
- Unchanged
- One step closer to a base case, using the inverse of the function in the data definition
2
New cards
Looking at indicators of the accumulative recursion pattern,
1. all arguments to recursive function applications are
- unchanged, or
- one step closer to a base case in the data definition, or
- a partial answer (passed in an accumulator)
2. The value in the accumulator are use in one or more base cases
3. The accumulatively recursive function usually has a wrapper function that sets the initial value of the accumulator
3
New cards
When does mutual recursion occur?
It occurs when two or more functions apply each other: f applies to g and g applies f
4
New cards
In simple recursion,
all arguments to the recursive function application (or applications, if there are more than one) are either unchanged, or one step closer to a base case in the data definition
5
New cards
In accumulative recursion,
parameters are as above, plus parameters containing partial answers used in the base case
6
New cards
In mutual recursion,
two or more functions call each other. Parameters usually behave as in simple recursion, but that is not required
7
New cards
In generative recursion,
parameters are freely calculated at each step.