Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am trying to get all distinct palindromic substrings/subarray which are greater than length 3. So I got these 2 answers related to Manachers algorithm

I am trying to get all distinct palindromic substrings/subarray which are greater than length 3. So I got these 2 answers related to Manachers algorithm O(N) which gets distinct longest palindromic substrings/subarray. But somehow if i extend solution overall complexity is greater than O(N) as the longest palindrome subsequence need to subdivded further.

Lets take these 2 example,

[1, 3, 4, 3, 1, 1, 2 , 2, 1, 5] = Manachers algo gives [1,3,4,3,1] [1,2,2,1]. << these 2 subarray where from first we can again get [3,4,3] << for expansion also we need further processing. In same algorithm I am not able to expand/get [1,3,4,3,1] to [1,3,4,3,1] [3,4,3] in O(N) << as this is valid palindrom substring. Can reprocess result and get the desired but time complexity increases. [4, 4, 4, 4, 4] = then we have [4,4,4] [4,4,4,4] [4,4,4,4,4].

Here are ealier solution, https://www.chegg.com/homework-help/questions-and-answers/need-find-palindromic-substring-input-string-width-greater-equal-3-fastest-way-pattern-way-q108409268?recommendationId=4a00eaaa-7a73-42dd-95ab-6b9e088ab89f®ionName=recent%20activity§ionId=59f94615-8153-4db3-87df-fef44092bbd6 https://www.chegg.com/homework-help/questions-and-answers/manachers-algorithm-o-n-find-distinct-palindromic-substring-subarray-example-1-3-4-3-1-1-2-q108438877?recommendationId=d4420a3c-338c-4051-9a8e-aff9b54ef85e®ionName=recent%20activity§ionId=f24f923f-4726-4161-bda7-d73ce7d50ac4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Do you currently have a team agreement?

Answered: 1 week ago

Question

c. How is trust demonstrated?

Answered: 1 week ago

Question

c. Will leaders rotate periodically?

Answered: 1 week ago