Dynamic Programming Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Recursive Programming

A

Recurssive problems can always be solved using recursion. Example: Fibonacci

def F(n)
     return 1 if n>3
           else F(n-1) + F(n-2)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Simple recurssive approaches are often very wasteful because we solve subproblems many times

A

an exponential number of times in the case of Fibonacci

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

Dynamic Programming is a algorithmic paradigm

A

We will use pairwise alignment of sequence data

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

Recurrsive programming

A

Many recurssive problems have recurrsive solutions. Breaking down into subprblems can lead to solution of overall problem

Subproblems on the boundaries of the problem space (the smallest ones) often have trivial solutions

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

Factorial computation can be solved by a recurssive equation

A

..

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

Dynamic programming is much faster than recurssive programmming

A

Dynamic programming is going to increase by linear to input value

Recurssive programming is going to increase exponentially to the input value

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

Dynamic programming saving the output you compute instead of re-computing it again

A

..

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

Challenging part of dynamic programming is how to divide it into subproblems

A

How and where you will save it into memory.

Fibonacci you save it into array.

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

Dynamic programming allows going into polynomial run time algorithm

A

Number of subproblems should grow polynomically

algorithmically the runtime wil grow proportionally tonumber of EDGES (not vertex)

V | < | E | < | V | choose 2

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

EDIT Distance

A

the mnimum number of mismatches across all possible aligments.

Want to try to come up with all possible alignments?

Better how to divide problem into subproblems

When thinking of subproblems think of how to reduce/reuse values

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

Prefix alignment allows for recursion

A

..

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

Backtracking

A

while filling the table, save which of the three possibilitieswe chose

  • at the end, by following the arrows, we get an alignment
    • a match when we got diagonally up
    • a das
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Full graph is called….

A

Dependency Graph

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

Waterfall Ordering

diagonal approach

A

Allows for parallel programming

How you order things can be important

For more information about waterfall ordering
Marc Snir Illinois

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

Ordering has to deal with memory too.

A

The way table was created was not necessary. Anytime if we are trying to compute, only need previous row don’t need the much older rows. To find edit distance just keep previous row.

If just do one row at a time we will have asymptotic runtime

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

Memoization

A

Dynamic programing is typicallly described in terms of multidimensional tables or arrays that are filled from one side to ther other. The table both gives the order and the memory.. But it not need be that way.

Memoization Dynamic programming can be implementated recurssively.

  • use a recursive code, but simply save solutions to subproblems in the memory and look up the memory before the recursive call
  • sometimes uses a data strcture other than an array (i.e. diciotnary)
  • the order is defined by a bottom-up traversal of the subproblem DAG
17
Q

Local vs Global Alignment

A

Global Alignment :

18
Q

Penalize (beta)

Probability of having a insertion or deletion

Every time you add a gap you add a beta

A

.

19
Q

Unrooted tree

A

undirected graph in which any two nodes are connected by exactly one path

20
Q

Rooted Tree

A

Designating one node as the root and orientating all edges away form the root gives an undirected graph that repsrents a rooted tree

21
Q

many problems have obvious easy recursive solutions

A

the solution to the full problem can be formulated as a function of solutions to set of subproblems, which depends on smaller subproblems

boundary conditions (base case)

22
Q

Linearization of is any partial order of a full order that is compatible with that partial order

A

Child should come before the parent

23
Q

Save results in the memory to reduce recurssive computation

A

Before do a sub problem, check the memory

24
Q

If you know your subproblem ahead of time in advance…. (dependencies)

A

then you can design your program to be efficient