Question: For each of the problems in the easy section it is enough to describe in English the idea of your algorithm, define the memo table,

 For each of the problems in the easy section it is

For each of the problems in the easy section it is enough to describe in English the idea of your algorithm, define the memo table, write the base case and the recursive step to fill the table, and analyze the run time. No need for pseudo code. Given a string s of length n, design an algorithm that outputs the smallest number k such that s-w1w2wk where each w; is a palindrome. In other words, find the smallest k such that s can be written as a concatenation of k palindromes. For the definition of a palindrome see practice problems. For example if s-"add" then the algorithm should output k = 2 since we can take wi ="a" and w2-dd". On the other hand, if 8-ada", then the algorithm should output k-1 e Given two strings of length n and m, design an algorithm that outputs the length of the longest common substring of the two strings. If A[1,...n] is the array representing a string, then any contiguous chunk Ali,....j] is a substring of A. . Given an array A1,... , n] of integers, design a dynamic programming algorithm running in time O(n) to find indices i,j such that the subarray Ali,... , j] has the maximum sum. You are given a set of n non-negative integers, and a target integer K. You need to find out of there exists a subset of the n integers that adds up to K. Design a dynamic programming algorithm for this problem that runs in time O(nK) . Given a string of length , a subsequence is any non empty subset of characters read from left to right. For example, if A-atc then a, t, c, at, tc, ac, atc are all subsequnces of A. Given two strings of length n, m, design an algorithm that outputs the length of the longest common subsequence (LCS) of the two strings. Modify the algorithm for the longest common subsequence (LCS) problem that you designed above such that it runs in time O(nm) but only uses O(min(n, m)) space. For each of the problems in the easy section it is enough to describe in English the idea of your algorithm, define the memo table, write the base case and the recursive step to fill the table, and analyze the run time. No need for pseudo code. Given a string s of length n, design an algorithm that outputs the smallest number k such that s-w1w2wk where each w; is a palindrome. In other words, find the smallest k such that s can be written as a concatenation of k palindromes. For the definition of a palindrome see practice problems. For example if s-"add" then the algorithm should output k = 2 since we can take wi ="a" and w2-dd". On the other hand, if 8-ada", then the algorithm should output k-1 e Given two strings of length n and m, design an algorithm that outputs the length of the longest common substring of the two strings. If A[1,...n] is the array representing a string, then any contiguous chunk Ali,....j] is a substring of A. . Given an array A1,... , n] of integers, design a dynamic programming algorithm running in time O(n) to find indices i,j such that the subarray Ali,... , j] has the maximum sum. You are given a set of n non-negative integers, and a target integer K. You need to find out of there exists a subset of the n integers that adds up to K. Design a dynamic programming algorithm for this problem that runs in time O(nK) . Given a string of length , a subsequence is any non empty subset of characters read from left to right. For example, if A-atc then a, t, c, at, tc, ac, atc are all subsequnces of A. Given two strings of length n, m, design an algorithm that outputs the length of the longest common subsequence (LCS) of the two strings. Modify the algorithm for the longest common subsequence (LCS) problem that you designed above such that it runs in time O(nm) but only uses O(min(n, m)) space

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!