Algorithm to find a measurement of similarity between lists.

Posted by Cubed on Stack Overflow See other posts from Stack Overflow or by Cubed
Published on 2011-02-24T20:10:24Z Indexed on 2011/02/24 23:25 UTC
Read the original article Hit count: 263

Filed under:
|
|
|

Given that I have two lists that each contain a separate subset of a common superset, is there an algorithm to give me a similarity measurement?

Example:

A = { John, Mary, Kate, Peter } and B = { Peter, James, Mary, Kate }

How similar are these two lists? Note that I do not know all elements of the common superset.

Update: I was unclear and I have probably used the word 'set' in a sloppy fashion. My apologies. Clarification: Order is of importance. If identical elements occupy the same position in the list, we have the highest similarity for that element. The similarity decreased the farther apart the identical elements are. The similarity is even lower if the element only exists in one of the lists.

I could even add the extra dimension that lower indices are of greater value, so a a[1] == b[1] is worth more than a[9] == b[9], but that is mainly cause I am curious.

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about list