mirror of
https://github.com/Manoj-HV30/dsa-competitive-programming.git
synced 2026-05-16 19:35:22 +00:00
Add notes on palindrome algorithms
Added notes on palindrome algorithms including expand-around-center and Manacher's Algorithm.
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
The expand-around-center approach checks every character (and every gap between characters) as a potential palindrome center and expands outward to verify palindromes, resulting in repeated character comparisons and a worst-case time complexity of O(n²).
|
||||||
|
|
||||||
|
In contrast, Manacher’s Algorithm optimizes this process by transforming the string and using palindrome symmetry to reuse previously computed information, thereby eliminating redundant expansions and achieving a linear time complexity of O(n).
|
||||||
|
in the code
|
||||||
|
C -> center of the rightmost palindrome
|
||||||
|
R -> right boundary of rightmost Palindrome
|
||||||
|
|||||||
Reference in New Issue
Block a user