Recursion & Iteration Flashcards

1
Q

What is a recursive function?

A

A function that calls itself and returns a predetermined value when encountering a base case.

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

What is one advantage and disadvantage of a recursive implementation over an iterative implementation?

A

Advantage: A recursive implementation allows the task to be divided among many threads
Disadvantage: A recursive implementation has higher overhead than the iterative implementation.

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

What is meant by a recursive subroutine?

A

It is a unit of program that calls itself.

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

What is iteration?

A

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

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

What is time complexity?

A

Time efficiency describes how execution time increases with data size / number of elements

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