Compare tuples of different lenght
Jurgens de Bruin
debruinjj at gmail.com
Sat Aug 20 05:00:42 EDT 2011
On Aug 20, 10:45 am, Chris Rebert <c... at rebertia.com> wrote:
> On Sat, Aug 20, 2011 at 1:25 AM, Jurgens de Bruin <debrui... at gmail.com> wrote:
> > Hi,
> > I have a list of tuples:
> > [(2,),(12,13),(2,3,4),(8,),(5,6),(7,8,9),]
> > I would like to compare all the tuples to each other and if one
> > element if found two tuples the smallest tuples is removed from the
> > list.
> So, would [(5,6), (6,7,8)] become [(6,7,8)] ?
> If no, then I believe you're trying to solve the set covering problem:http://en.wikipedia.org/wiki/Set_cover_problem
[(5,6), (6,7,8)] will indeed become [(6,7,8)]
More information about the Python-list