Question: Problem 2: (5 2 points) We will call a word palindrome if it is symmetric. For example, ababa and abcba are palindromes and abcde is

Problem 2: (5 2 points) We will call a word palindrome if it is symmetric. For example, "ababa" and "abcba" are palindromes and "abcde" is not. Design an algorithm that finds the number of the ways to cut a given word into palindromes of length more than one using O(n3) operations, where the length of the word is n. For example, "aabbaabbaa" can be cut as "aa" "bb"aa""bb" "aa", "aa" "bbaabb""aa", "aa""bb" + "aabbaa", "aabbaa" + "bb" + "aa", and just "aabbaabbaa", so the answer will be 5 (challenge: try to do it in O(n2) operations)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
