18 DP String Apps2
18 DP String Apps2
Dynamic Programming
(MatExp, Strings)
5
Longest Palindromic Subsequence
Given a string S[1,..., n], what is the size of the longest subsequence
which is also a palindrome.
Eg. abaccdba = 6 (abccba)
6
Longest Palindromic Subsequence
Given a string S[1,..., n], what is the size of the longest subsequence
which is also a palindrome.
Eg. abaccdba = 6 (abccba)
7
Palindrome Partitioning
Given a string S[1,..., n], what is the minimum number of partitions such
that each partition is a palindrome.
Eg. ababbbabbababa = 3 (a|babbbab|b|ababa)
9
Palindrome Partitioning
Given a string S[1,..., n], what is the minimum number of partitions such
that each partition is a palindrome.
Eg. ababbbabbababa = 3 (a|babbbab|b|ababa)
10
Pattern in a given Text
General Version:
Given a dictionary of k words, preprocess them to report
all their appearances in text T in O(n).
11
Pattern in a given Text
General Version:
Given a dictionary of k words, preprocess them to report
all their appearances in text T in O(n).
13
Pattern in a given Text
14