Recursion and Dynamic Programming Flashcards

1
Q

Overlapping Subproblems (Dynamic Programming)

A

When finding a problem’s solution involves solving the same subproblem multiple times.

Examples:
* Fibonacci Sequence

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

Memoization

A

Ensures that a method doesn’t run for the same inputs more than once by keeping a record of the results for the given inputs (usually a hash)

Memoization is a common strategy for dynamic programming problems

However, going bottom-up is usually cleaner and often more efficient.

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

Bottom-up Algorithms

A

“Starts from the beginning”

as opposed to recursion which often starts from the end and works backwards.

Bottom-up is a way to avoid recursion, saving memory cost that recursion incurs when it builds up the call stack.

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