Skip to content

Problem on article Manacher's Algorithm - Finding all sub-palindromes in O(N) #1372

Closed
@BYTE128

Description

@BYTE128

Article: Manacher's Algorithm - Finding all sub-palindromes in O(N)

Problem:

Below line ->

p[i] = max(0, min(r - i, p[l + (r - i)]));

in manacher_odd function, is max(0, ..) check really required?

As I tried some examples on paper, it seemed every time, the least value of p[i] = min(r - i, p[l + (r - i)]) is 0, so, can we write directly,

p[i] = min(r - i, p[l + (r - i)]);

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions