Quantcast
Viewing all articles
Browse latest Browse all 22137

I have made recurrence relation which finds the longest contiguous common string between two strings how can i skip one char in my one of the string

int lcs(int i, int j, int count) {     if (i == 0 || j == 0)         return count;     if (X[i-1] == Y[j-1]) {         count = lcs(i - 1, j - 1, count + 1);     }         count = max(count, max(lcs( i, j - 1, 0), lcs( i - 1, j, 0)));     return count; } 

For example:The X contains AABB and Y contains AACB i want my recurrence relation to skip c to give AAB as the lCCS, this is what i have done so far.


Viewing all articles
Browse latest Browse all 22137

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>