LCS with strings of distinct elements in O(nlg(n))

Правка en1, от kowalsk1, 2018-05-29 05:08:09

So here´s the problem:

Given two sequences of number s and r, such that all elements from the sequences are distinct, find the longest common subsequence of both sequences.

Now i know the DP solution for the general, which is executed in O(n2), but in this problem i need to get as efficient as O(nlg(n)). I found an explanation on stack overflow about how to use the LIS (Longest Increasing Subsequence) algorithm to achieve this complexity, but i didn´t understand very well. So does anyone how to explain a faster than squared algorithm to solve this problem?

Thanks ahead.

Теги lcs, map, string

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en7 Английский kowalsk1 2018-05-29 05:11:47 8 Tiny change: 'ster than squared algorithm' -> 'ster than quadratic algorithm'
en6 Английский kowalsk1 2018-05-29 05:11:05 5 Tiny change: 'he general, which is' -> 'he general case, which is'
en5 Английский kowalsk1 2018-05-29 05:10:35 25 (published)
en4 Английский kowalsk1 2018-05-29 05:09:56 6 Tiny change: 'nt as $O(n*lg(n))$. I' -> 'nt as $O(n lg(n))$. I'
en3 Английский kowalsk1 2018-05-29 05:09:25 9
en2 Английский kowalsk1 2018-05-29 05:08:39 3 Tiny change: 'es.\n\nNow i know th' -> 'es.\n\nNow, i know th'
en1 Английский kowalsk1 2018-05-29 05:08:09 648 Initial revision (saved to drafts)