Recursion & Iteration Flashcards
What is a recursive function?
A function that calls itself and returns a predetermined value when encountering a base case.
What is one advantage and disadvantage of a recursive implementation over an iterative implementation?
Advantage: A recursive implementation allows the task to be divided among many threads
Disadvantage: A recursive implementation has higher overhead than the iterative implementation.
What is meant by a recursive subroutine?
It is a unit of program that calls itself.
What is iteration?
Iteration is the process of repeating a task to achieve a specific end goal
When iteration is employed, the set of instructions within the loop will keep repeating until a certain condition has been reached or is no longer satisfied
What is time complexity?
Time efficiency describes how execution time increases with data size / number of elements