Question: A palindrome is a sequence that is the same as its reverse. For example, the word RACECAR is a palindrome. For this problem we will
A palindrome is a sequence that is the same as its reverse. For example, the word
"RACECAR" is a palindrome.
For this problem we will define an almost palindrome to be a sequence that can be
transformed into its reverse with or fewer character additions, deletions, replacements,
or swaps. A character swap swaps two adjacent characters.
For instance "MARJORAM" can be reversed by swapping the J and the O In addition,
"FOOLPROOF" can be reversed by replacing the R with and and vice versa. Finally,
the word "BONOBO" can be reversed by deleting the final O and reinserting it at the
beginning.
Devise a dynamic programming algorithm that will determine the number of edits
necessary to to transform a sequence into its reverse.
a State this problem with formal input and output conditions.
b State a selfreduction for this problem.
c State a dynamic programming algorithm based off of your selfreduction that
computes the minimum number of edits to transform a sequence into its reverse.
d Use your algorithm to determine the minimum number of edits to transform
"MARJORAM", "FOOLPROOF" and "BONOBO" into their reverses. Show your
work.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
