Function to find longest common subsequences of a list of lists?

Sean Clark Hess

How can I find the longest subsequences that two lists have in common? For example:

["abcdefg", "abc__fg", "ab____g"] 

It should return:

["ab", "g"]

Is there an existing function that does this? How would you compose one from existing ones?

Sergey Romanovsky

You're looking for Data.List.CommonSubstring

$ ghci
λ: :m +Data.List.CommonSubstring
λ: longestSubstring "abcdefg" "abc__fg"
"abc"

It's unclear what exactly you want (longest subsequence or all possible subsequences), so feel free to use Data.SuffixTree directly to implement required logic.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Dictionary with lists as values - find longest list

From Dev

Find common items in list of lists of strings

From Dev

Find common items in list of lists of strings

From Dev

Most efficient way to find longest incrementing subsequence in a list of lists

From Dev

Longest list in SortedList of Lists

From Dev

Find longest non-breaking common elements in a list

From Dev

Find longest non-breaking common elements in a list

From Dev

Writing function to find longest path through list (recursion maybe?)

From Dev

Python: Length of longest common subsequence of lists

From Dev

Longest common substring between two long lists

From Dev

Finding length of the longest list in an irregular list of lists

From Dev

Number of all longest increasing subsequences

From Dev

Find the longest common prefix of two strings

From Dev

Find longest common subsequence of 2 String?

From Dev

Find longest common date span in SQLite

From Dev

Length of Longest Common sequence Python recursive function

From Dev

Return the longest common Substring Function c ++

From Dev

Find length of a list of lists

From Dev

Find a number in list of lists

From Dev

Python Longest list in a list of lists; with empty list support

From Dev

How to find subsequences?

From Java

Recursive function for list of lists

From Dev

find longest shortest attribute in a list of objects

From Dev

How to the find the longest match from a set of lists in Python?

From Dev

Get a list of all subsequences

From Dev

Pass list of lists of list to function

From Dev

Standard function for replacing subsequences

From Dev

Function for replacing subsequences

From Dev

Standard function for replacing subsequences

Related Related

HotTag

Archive