Recursion Flashcards

1
Q

Many useful algorithms are r_____________ in structure.

A

recursive

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

What is Recursion?

Recursion is when a method in the algorithm which calls itself from within itself.
See John’s video on YouTube.

Merge Sort uses r_______________ to sort the smaller subarrays.

A

recursion

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

Divide and Conquer

A divide-and-conquer approach: breaks the problem into several subproblems that are similar to the original problem but smaller in size, solve the subproblems recursively and then combine these solutions to create a solution to the original problem.

1) D_____________ the problem into subproblems
2) C_____________ the subproblems recursively, or simply.
3) C____________ the solutions to the subproblems into
the solution for the original problem.

A

Divide
Conquer
Combine

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

Time Complexity -NB

Our merge sort takes theata(n) , but in reality it takes longer.
I think we are working on a simplified version at the moment.

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

Loop Invariants

A loop invariant is a tool used to prove the c_______________ of an algorithm, specifically in regards to a loop.

It is a property or set of properties of type b_________, that must be aligned with the goal of the algorithm.

It MUST hold (be true) at initialization, maintenance, and t__________.

A

correctness
boolean
termination

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