cs126 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 a recursion base case?

Values of the input variables for which we perform no recursive call.

2
New cards

What is a recursive call?

A call to a recursive method inside the method.

3
New cards

What are the two rules for a recursive method?

  • Every possible chain of recursive calls must eventually reach a base case.

  • Each call should be defined so that it progresses towards a base case.

4
New cards

Define tail recursion.

  • When a linearly recursive method makes its recursive call as its last step 

  • e.g. reverse_array()

5
New cards

What is the cost of reversing the order of an array using linear recursion?

ϴ(n)

6
New cards

What is the cost of running the recursive factorial algorithm?

ϴ(n)

7
New cards

What is the cost of running the recursive Fibonacci algorithm?

O(2n)

8
New cards

Define a fractal.

  • A geometric figure that can be divided into parts

  • Each of which is a reduced-size copy of the whole figure

  • e.g. the Sierpinski Triangle