Skip to content

Manacher's Algorithm's implementation is not correct. (Strings) #1720

Closed
@faizan2700

Description

@faizan2700

Manacher's algorithms can find the longest palindromic substring in linear time , or the number of substrings that are palindrome in linear time. But the implementation given in strings directory gives the complexity of n^2 we can easily see that for loop is iterating every character as center and from center palindromic length is calculated through recursive calls so the overall complexity is n^2. (although the description is correct manacher's algo is supposed to be linear).

I am working on this and I also want to add the number of substrings that are palindrome in given string which is other implementation of manacher's algorithm.

Metadata

Metadata

Assignees

Labels

enhancementThis PR modified some existing files

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions