Computing a Longest Common Subsequence of two strings when one of them is Run Length Encoded - Ahsan, Shegufta Bakht; Moosa, Tanaeem M.; Rahman, M. Sohel; Shahriyar, Shampa (INFOCOMP Journal of Computer Science, 2011)
Given two strings, the longest common subsequence (LCS) problem computes a common subsequence that has the maximum length. In this paper, we present new and efficient algorithms for solving the LCS problem for two strings one of which is run length encoded (RLE). We first present an algorithm that runs in O(gN) time, where g is the length of the RLE string and N is the length of uncompressed string. Then based on the ideas of the above algorithm we present another algorithm that runs in O(Rlog(log g)+N) time, where R is the total number of ordered pairs of positions at which the two strings match. Our first algorithm matches the best algorithm in the literature for the same problem. On the other hand, for R < gN/ log(log)g, our second algorithm outperforms the best algorithms in the literature.