Results 1 to 2 of 2

Thread: longest common sequential subsequence

  1. #1
    Join Date
    Jul 2022

    longest common sequential subsequence

    I know how to calculate the lcs of two sequences/strings, however lcs does not need that the subsequence be sequential. I tried it the following way:
    [COLOR=var(--black-800)]function lccs(a, b)[/COLOR]
        if a.length == 0 or b.length == 0
            return ""
        possible = []
        if a[0] == b[0]
          possible.push(lcs(a[1:), b[1:])
        possible.push(lcs(a[1:], b))
        possible.push(lcs(a, b[1:)) [COLOR=var(--black-800)]    return longest_string(possible)[/COLOR]
    longest string returns the longest string in an array, where s[1:] represents a slice of s beginning with the first character.
    I've ran this in javascript within a browser and in golang on a remote server, where I put each call to lccs in its own goroutine, but I have no information about the server's hardware specs, thus I have no notion about the parallelization of these routines. I tried reading from this site but couldn't get it right; can someone help?
    It ran far too slowly in each of these circumstances.

  2. #2
    Join Date
    Mar 2010

    Re: longest common sequential subsequence

    Google found this:

    I've never had this homework assignment, don't use javascript, nor Go and my code doesn't do this sort of text processing. I do lots of text conversions for specific outputs, but that's very different than this. None of my professional work did any text processing.

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts