CS3000: Algorithms & Data Jonathan Ullman
Lecture 8:
- Dynamic Programming: RNA Folding, Practice
CS3000: Algorithms & Data Jonathan Ullman Midterm Info Lecture - - PowerPoint PPT Presentation
CS3000: Algorithms & Data Jonathan Ullman Midterm Info Lecture 8: Dynamic Programming: RNA Folding, Practice Feb 3, 2020 Examples Dynamic Programming Choose a subset Interval One variable recurrence Scheduling Partition the line
Examples
Choose a
subset
Scheduling
One variable
recurrence
Partition the line into intervals
Segmented Least Squares
Choose a subset
Knapsack
Two arable
recurrence
Choose the last piece of
Edit Distance Alignments
theatrgnnert
Choose
a subset
Concert Scheduling
recurrence
Parr up items Two variable recurrence
O O
O
O O
I
2
5
6
no crossing
00 O
he pours too close together
O is the optimal solutionusing by ibn
i
is
n
t
the optimal soliton using bi
t the optimal solution using beet
bn
I
AM
A
n f
n
here
B
B
Kien
subproblem
bonds
OPT
i j
OPT
i j
1
OPT
i j
It
0PT
i
t
1
OPT t 11 j
l
B
Maximum over all A such that
B are compatible bases
Max EA B
hyrax
OPT ,, - = max OPT ,, - − 1 , max
OPPQROSPT N OPT ,, A − 1 + OPT A + 1, - − 1
9
ACCGGUA
it
CCGGUA
CCGGUAG
2 8
CGGUAG
CGGUAGU
3 9
2 8
GGUAGU ACCGGUAG
8
3 7
4 7
CCGGUAGU
2 9
O L
use the
Hpt fort
@ 5Y> = @ @Z> W
Erickson Book
Notation … means … Think… E.g. f(n)=O(n) ∃a > 0, ;c > 0, ∀; ≥ ;c: 0 ≤ f ; ≤ ag(;) At most “≤” 100n2 = O(n3) f(n)=W(g(n)) ∃a > 0, ;c > 0, ∀; ≥ ;c: 0 ≤ ag ; ≤ f(;) At least “≥” 2n = W(n100) f(n)=Q(g(n)) f ; = = g ; and f ; = j(g ; ) Equals “=” log(n!) = Q(n log n) f(n)=o(g(n)) ∀a > 0, ∃;c > 0, ∀; ≥ ;c: 0 ≤ f ; < ag(;) Less than “<” n2 = o(2n) f(n)=w(g(n)) ∀a > 0, ∃;c > 0, ∀; ≥ ;c: 0 ≤ ag ; < f(;) Greater than “>” n2 = w(log n)
m ; = = ;r
5 = = f 5Z>
@ 5Y>
2.882
2.804
n
n
Z
3
n
> = = g and f W = = g .
> + f W = = g .
n
t TLE
Drawing the recursion tree
n
in
tn
F(n): For i = 1,…,n2: Print “Hi” For i = 1,…,3: F(n/3) 1In
n2t3T
n loglogn
T 2
Good discussionof
pseudocode
A[1:n] is a global array SillySort(1,n): if (n <= 2): put A in order else: SillySort(1,2n/3) SillySort(n/3,n) SillySort(1,2n/3)
ki
score
10