MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Find common elements in a list of sublists


On 4/3/2012 4:44 AM, Cisco Lane wrote:
> Suppose I have a list of sublists:
>
> d={{1, 19}, {1, 23}, {1, 5, 25}, {1, 17}, {1, 11}, {1, 5}}
>
> How do I find the elements common to all the sublists?
>
> I can do it using intersection:
>
> Intersection[dx[[1]], dx[[2]], dx[[3]], dx[[4]], dx[[5]], dx[[6]]]
>
> which yields, correctly, {1}, but what if the number of sublists in d is variable?
>

MapThread[Intersection, d, 0]

-- 
Helen Read
University of Vermont



  • Prev by Date: Re: Find common elements in a list of sublists
  • Next by Date: subgraph error
  • Previous by thread: Re: Find common elements in a list of sublists
  • Next by thread: Re: Find common elements in a list of sublists