Skip to content

Commit

Permalink
Merge pull request #4999 from Sosuke23/b
Browse files Browse the repository at this point in the history
minor add
  • Loading branch information
ryanchou-dev authored Dec 23, 2024
2 parents dd5d3e8 + f0dda54 commit 95a1fba
Showing 1 changed file with 27 additions and 25 deletions.
52 changes: 27 additions & 25 deletions content/6_Advanced/String_Search.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,26 @@ print(len(s))
<FocusProblem problem="manacherFocus" />
<Resources>
<Resource
source="HR"
title="Manacher's Algorithm"
url="https://www.hackerrank.com/topics/manachers-algorithm"
/>
<Resource
source="Medium"
title="Manacher’s Algorithm: Longest Palindromic Substring"
url="https://yuminlee2.medium.com/manachers-algorithm-longest-palindromic-substring-cc97fa615f8b"
starred
>
</Resource>
<Resource
source="cp-algo"
title="Manacher's Algorithm"
url="string/manacher.html"
/>
</Resources>
**Manacher's Algorithm** functions similarly to the **Z-Algorithm**. It
determines the longest palindrome centered at each character.
Expand Down Expand Up @@ -356,25 +376,6 @@ int main() {
</CPPSection>
</LanguageSection>
<Resources>
<Resource
source="HR"
title="Manacher's Algorithm"
url="https://www.hackerrank.com/topics/manachers-algorithm"
/>
<Resource
source="Medium"
title="Manacher’s Algorithm: Longest Palindromic Substring"
url="https://yuminlee2.medium.com/manachers-algorithm-longest-palindromic-substring-cc97fa615f8b"
starred
>
</Resource>
<Resource
source="cp-algo"
title="Manacher's Algorithm"
url="string/manacher.html"
/>
</Resources>
<Info title="Don't Forget!">
If s[l, r] is a palindrome, then s[l+1, r-1] is as well.
Expand Down Expand Up @@ -407,6 +408,12 @@ character palindrome must have been created from a palindrome of length $-1$
<FocusProblem problem="trieFocus" />
<Resources>
<Resource source="CPH" title="26.2" />
<Resource source="CF" title="Algorithm Gym" url="15729" />
<Resource source="PAPS" title="14.1 - Tries" />
</Resources>
A trie is a tree-like data structure that stores strings. Each node is a string, and each edge is a character.
The root is the empty string, and every node is represented by the characters along the path from the root to that node.
Expand Down Expand Up @@ -481,11 +488,6 @@ int main() {
</CPPSection>
</LanguageSection>
<Resources>
<Resource source="CPH" title="26.2" />
<Resource source="CF" title="Algorithm Gym" url="15729" />
<Resource source="PAPS" title="14.1 - Tries" />
</Resources>
<Problems problems="trie" />
Expand Down Expand Up @@ -523,7 +525,7 @@ For example, when transitioning from $i$ to $i+1$ in $S$ there only are two choi
1. If $node$ does have an outgoing edge with letter $S_{i+1}$, then move down the edge.
2. Otherwise, follow the failure link of $S_i$ and transition to letter $S_{i+1}$ from there.
The image below depicts how the structure looks like for the words $[a, ag, c, caa, gag, gc]$.
The image below depicts how the structure looks like for the words $[a, ag, c, caa, gag, gc, gca]$.
<center>
![Trie](./Trie.png)
Expand Down

0 comments on commit 95a1fba

Please sign in to comment.