Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Joseph recently received some strings as his birthday gift from Chris. He is interested in the similarity between those strings. He thinks that two strings
Joseph recently received some strings as his birthday gift from Chris. He is interested in the similarity between those strings. He thinks that two strings a and b are considered J-similar to each other in one of these two cases: 1. a is equal to b. 2. he can cut a into two substrings ai, a2 of the same length, and cut b in the same way, then one of following is correct: (a) ay is J-similar to b1, and az is J-similar to b2. (b) az is J-similar to b1, and ai is J-similar to b2. Caution: the second case is not applied to strings of odd length. He ask you to help him sort this out. Please prove that only strings having the same length can be J-similar to each other, then design an algorithm to determine if two strings are J-similar within O(nlogn) time (where n is the length of strings)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started