What is a time complexity for finding all the maximal palindrome in a string?

Category: QuestionsWhat is a time complexity for finding all the maximal palindrome in a string?
Editor">Editor Staff asked 4 weeks ago

What is a time complexity for finding all the maximal palindrome in a string?
 
(a) Ɵ (n)
 
(b) Ɵ (n!)
 
(c) Ɵ (1)
 
(d) O (log n!)
 
Question is from Suffix tree in chapter Trie of Data Structures & Algorithms I
 
I have been asked this question in examination.

1 Answers
Editor">Editor Staff answered 4 weeks ago

Correct choice is (a) Ɵ (n)
 
The explanation is: Palindrome is a string that is the same when reading forward as well as backward. To check if a substring is present in a string of a length of n, the time complexity for such operation is found to be O (n). The time complexity for finding all the maximal palindrome in a string is Ɵ (n).