Hi.
I'm looking for DP problems that involve printing the items that give the optimal answer(involves reconstructing the optimal items), like printing the Knapsack items for example.
If you know any similar problems, please comment with them.
Thanks in advance.
Problem 1 Problem 2
1) Print longest common subsequence of two strings/arrays.
2) Print longest increasing subsequence of an array.(I can do it in O(N^2), can someone tell me how to do it in O(N*logN), please?)
3) http://acm.timus.ru/problem.aspx?space=1&num=1303
4) http://acm.timus.ru/problem.aspx?num=1112
If you want to print the actual sequence too, you can also store the node where you "come from" in each node in the tree. The optimum answer will be contained in some leaf of the tree.
Thanks a lot!