Longest Palindromic Substring: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{DISPLAYTITLE:Longest Palindromic Substring (Longest Palindromic Substring)}} == Description == Given a string of length $n$, find the palindromic substrings of maximal length. == Parameters == <pre>n: length of given string</pre> == Table of Algorithms == {| class="wikitable sortable" style="text-align:center;" width="100%" ! Name !! Year !! Time !! Space !! Approximation Factor !! Model !! Reference |- | Naive (Longest Palindromic Substring Longest Palin...") |
No edit summary |
||
(4 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
== Parameters == | == Parameters == | ||
$n$: length of given string | |||
== Table of Algorithms == | == Table of Algorithms == | ||
Line 16: | Line 16: | ||
|- | |- | ||
| [[Naive (Longest Palindromic Substring Longest Palindromic Substring)|Naive]] || 1940 || $O(n^{3})$ || $O({1})$ | | [[Naive (Longest Palindromic Substring Longest Palindromic Substring)|Naive]] || 1940 || $O(n^{3})$ || $O({1})$ || Exact || Deterministic || [https://www.geeksforgeeks.org/longest-palindrome-substring-set-1/ Space] | ||
|- | |- | ||
| [[Dynamic Programming (Longest Palindromic Substring Longest Palindromic Substring)|Dynamic Programming]] || 1953 || $O(n^{2})$ || $O(n^{2})$ || Exact || Deterministic || [https://www.geeksforgeeks.org/longest-palindrome-substring-set-1/ Space] | | [[Dynamic Programming (Longest Palindromic Substring Longest Palindromic Substring)|Dynamic Programming]] || 1953 || $O(n^{2})$ || $O(n^{2})$ || Exact || Deterministic || [https://www.geeksforgeeks.org/longest-palindrome-substring-set-1/ Space] | ||
|- | |- | ||
| [[Manacher (Longest Palindromic Substring Longest Palindromic Substring)|Manacher]] || 1975 || $O(n)$ || $O(n)$ | | [[Manacher (Longest Palindromic Substring Longest Palindromic Substring)|Manacher]] || 1975 || $O(n)$ || $O(n)$ || Exact || Deterministic || [https://doi.org/10.1145%2F321892.321896 Time] | ||
|- | |- | ||
| [[Jeuring (Longest Palindromic Substring Longest Palindromic Substring)|Jeuring]] || 1994 || $O(n)$ || $O(n)$ | | [[Jeuring (Longest Palindromic Substring Longest Palindromic Substring)|Jeuring]] || 1994 || $O(n)$ || $O(n)$? || Exact || Deterministic || [https://doi.org/10.1007%2FBF01182773 Time] | ||
|- | |- | ||
| [[Gusfield (Longest Palindromic Substring Longest Palindromic Substring)|Gusfield ]] || 1997 || $O(n)$ || $O(n)$ | | [[Gusfield (Longest Palindromic Substring Longest Palindromic Substring)|Gusfield ]] || 1997 || $O(n)$ || $O(n)$ || Exact || Deterministic || [https://www.cambridge.org/core/books/algorithms-on-strings-trees-and-sequences/F0B095049C7E6EF5356F0A26686C20D3 Time] | ||
|- | |- | ||
|} | |} | ||
== Time Complexity | == Time Complexity Graph == | ||
[[File:Longest Palindromic Substring - Time.png|1000px]] | [[File:Longest Palindromic Substring - Time.png|1000px]] | ||
Latest revision as of 10:10, 28 April 2023
Description
Given a string of length $n$, find the palindromic substrings of maximal length.
Parameters
$n$: length of given string
Table of Algorithms
Name | Year | Time | Space | Approximation Factor | Model | Reference |
---|---|---|---|---|---|---|
Naive | 1940 | $O(n^{3})$ | $O({1})$ | Exact | Deterministic | Space |
Dynamic Programming | 1953 | $O(n^{2})$ | $O(n^{2})$ | Exact | Deterministic | Space |
Manacher | 1975 | $O(n)$ | $O(n)$ | Exact | Deterministic | Time |
Jeuring | 1994 | $O(n)$ | $O(n)$? | Exact | Deterministic | Time |
Gusfield | 1997 | $O(n)$ | $O(n)$ | Exact | Deterministic | Time |