Recursive techniques Flashcards

1
Q

Define Recursion

A

Ability of subroutine to call itself

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What does a recursive call use

A

Stack and Stack Frames to store the data from each depth of function call

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What must be in a recursive algorithm

A
Define a base case
Define the general case
Base case will always be reached
Must stop calling itself^^
(otherwise will only stop when all available memory is used)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Recursion Advantages

A

Has fewer steps (easier for humans to read)

Natural way to process data structures

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Recursion Disadvantages

A

Harder to trace
Uses more memory (stack frames)
Slower (need to manage stack operations)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly