1. Computer Science Engineering (CSE)
  2. Design and Analysis of Algorithms
  3. In the worst case, the minimum number of...
Q.

In the worst case, the minimum number of insertions to be made to convert the string into a palindrome is equal to the length of the string.

A. true
B. false
C. answer: b
D. explanation: in the worst case, the minimum number of insertions to be made to convert the string into a palindrome is equal to length of the string minus one. for example, consider the string “abc”. the string can be converted to “abcba” by inserting “a” and “b”. the number of insertions is two, which is equal to length minus one.
Answer» B. false
Explanation: the string can be converted to “efgfe” by inserting “f” or to “egfge” by inserting “g”. thus, only one insertion is required.

Discussion