Longest palindromic substring: Difference between revisions

Content deleted Content added
Lurrch (talk | contribs)
Manacher's algorithm: I put some of the explanation of the algorithm as comments in the code so that it is clearer why it is working.
Tags: Mobile edit Mobile web edit
Lurrch (talk | contribs)
Manacher's algorithm: Made one comment a little clearer.
Tags: Mobile edit Mobile web edit
Line 87:
'''else if''' PalindromeRadii[MirroredCenter] > MaxMirroredRadius '''{'''
// The palindrome at MirroredCenter is biggerextends thanbeyond the palindrome at OldCenter
// The palindrome at Center must end at the edge of the OldCenter palindrome
// Otherwise, the palindrome at OldCenter would be bigger
Line 96:
// Since the palindrome at MirroredCenter ends exactly at the edge of the palindrome centered at OldCenter,
// the palindrome at Center might be bigger
// Set Radius to the minimum size of the palindrome centered at Center so it doesn't recheck unnecessarily
Radius = MaxMirroredRadius