Hi, Are you looking for a Longest Common Subsequence (LCS) algorithm? http://code.activestate.com/recipes/576869-longest-common-subsequence-problem-solver/
Cheers!! Albert-Jan ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- On Sun, 7/3/11, Christopher King <g.nius...@gmail.com> wrote: From: Christopher King <g.nius...@gmail.com> Subject: Re: [Tutor] Algorithm for sequence matching To: "Walter Prins" <wpr...@gmail.com> Cc: tutor@python.org Date: Sunday, July 3, 2011, 5:48 PM I know a way to do thatset1 = set(list1)set2 = set(list2)combined = set1&set2 On Sat, Jul 2, 2011 at 5:16 PM, Walter Prins <wpr...@gmail.com> wrote: Hi Ankur, On 2 July 2011 21:30, ANKUR AGGARWAL <coolankur2...@gmail.com> wrote: HeyI am looking for an algo for the largest sequence search in the two list. Example : list a accepts some say 'm' numbers. list b accept says 'n' numbers. I want to look for the largest same sequence between the two list and then display it. I tried out but failed to do so. Say A=[11,23,45,21,63,56,78,32]B=[56,78,11,23,45,21,111,234,56543] There are two similar sequence matching over here [11,23] and [23,45,21] i want to display second sequence because its larger in number. Plz help Thanks in Advance :) Umm, what about [11,23,45,21]? That seems to be longer still so should be the best one to display, or? Walter _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -----Inline Attachment Follows----- _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor