πŸ“Š Design and Analysis of Algorithms
Q. In which of the following cases the minimum no of insertions to form palindrome is maximum?
  • (A) string of length one
  • (B) string with all same characters
  • (C) palindromic string
  • (D) non palindromic string
πŸ’¬ Discuss
βœ… Correct Answer: (D) non palindromic string

Explanation: in string of length one, string with all same characters and a palindromic string the no of insertions is zero since the strings are already palindromes. to convert a non-palindromic string to a palindromic string, the minimum length of string to be added is 1 which is greater than all the other above cases. hence the minimum no of insertions to form palindrome is maximum in non-palindromic strings.


Explanation by: Mr. Dubey
in string of length one, string with all same characters and a palindromic string the no of insertions is zero since the strings are already palindromes. to convert a non-palindromic string to a palindromic string, the minimum length of string to be added is 1 which is greater than all the other above cases. hence the minimum no of insertions to form palindrome is maximum in non-palindromic strings.

πŸ’¬ Discussion

πŸ“Š Question Analytics

πŸ‘οΈ
426
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
86%
Success Rate