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

Tam ca

New member
What is a time complexity for finding all the maximal palindrome in a string?
A. Ɵ (n)
B. Ɵ (n!)
C. Ɵ (1)
D. O (log n!)
 
Answer: a
Explanation: 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).
 

Tìm kiếm

Back
Top