0

Suppose I have 2 big strings of size 10^5, How can I search for max common sub strings from both strings with complexity O(NlogN) using Hash and Binary Search. Explanation with code will be of great help :)

pshashi04
  • 222
  • 2
  • 12
  • Sounds a lot like homework you haven't bothered to attempt.... – Tony Delroy Feb 20 '18 at 14:03
  • You can say it was kind of homework, and I was able to achieve in O(N^2logN), But was looking for a solution with O(NlogN). The problem was I was while matching the hashes for strings I was also running a loop for checking char to char leading to n^2 for more accurate result. If you have any solution where I can achieve this in nlogn very accurately, please share. (You can share it as a story also instead of code ;) ) – pshashi04 Mar 06 '18 at 08:17
  • You'll find some "stories" about implementation on [wikipedia]( https://en.wikipedia.org/wiki/Longest_common_substring_problem), with efficiencies too. A quick google turns up [implementations](https://www.geeksforgeeks.org/longest-common-substring/). Hope that helps. – Tony Delroy Mar 06 '18 at 10:48

0 Answers0