Find the optimal solution to a 0/1 knapsack problem using dynamic programming. Write a program in C or C++ to solve a sample knapsack problem with n=7 items and maximum weight m=15. Also write a program to find the longest common subsequence between two DNA sequences and all subsequences shorter than the longest.
Find the optimal solution to a 0/1 knapsack problem using dynamic programming. Write a program in C or C++ to solve a sample knapsack problem with n=7 items and maximum weight m=15. Also write a program to find the longest common subsequence between two DNA sequences and all subsequences shorter than the longest.
Find the optimal solution to a 0/1 knapsack problem using dynamic programming. Write a program in C or C++ to solve a sample knapsack problem with n=7 items and maximum weight m=15. Also write a program to find the longest common subsequence between two DNA sequences and all subsequences shorter than the longest.
1. Find an optimal solution to the 0/1 knapsack instance n , m ,
( p1 , p2 , p3 ,⋯, pn ) , and ( w1 , w2 , w3 ,⋯, wn ) . Use dynamic programming strategy to get the optimal solution. Write a program in C or C++ to get the optimal solution. Input the following instance of the knapsack to check the validity where n = 7 , m = 15, ( p1 , p2 , p3 , p4 , p5 , p6 , p7 ) = (10,5,15,7,6, 18,3) , and ( w1 , w2 , w3 , w4 , w5 , w6 , w7 ) = (2, 3, 5, 7, 1, 4, 1). 2. The longest common subsequence (LCS) is defined as the longest subsequence that is common to all the given sequences, provided that the elements of the subsequence are not required to occupy consecutive positions within the original sequences. Write a generalized program in C or C++ to identify all the sub-sequences whose length is less than k, where k is the maximum length of the subsequence. Input, two DNA sequence R = <ACGTTCGA> and S = <BCTBBCA>. Find the longest common DNA subsequence and all the sub-sequences whose length is less than the maximum length of the subsequence.