Recursion

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/7

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

8 Terms

1
New cards

What is recursion?

Function that includes a call to itself

2
New cards

When is recursion is used?

Used whenever one subtask is a smaller version of the original task.

3
New cards

What is divide and conquer?

General problem-solving technique of breaking down a task into subtasks

4
New cards

What is iterative version of a function?

Non-recursive version of a method (use loop instead)

5
New cards

What are the two elements of recursion?

  • One or more recursive calls

  • Stopping condition, or base case, where no recursion is required

6
New cards

What is infinite recursion?

A method runs until the computer runs out of resources, and the program terminates abnormally

7
New cards

What is the error you get for infinite recursion?

builtins.RuntimeError: maximum recursion depth exceeded in comparison

8
New cards

What is stack?

Regions of memory used to store temporary data, including function calls and local variables.