Recursive techniques Flashcards
1
Q
Define Recursion
A
Ability of subroutine to call itself
2
Q
What does a recursive call use
A
Stack and Stack Frames to store the data from each depth of function call
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)
4
Q
Recursion Advantages
A
Has fewer steps (easier for humans to read)
Natural way to process data structures
5
Q
Recursion Disadvantages
A
Harder to trace
Uses more memory (stack frames)
Slower (need to manage stack operations)