MathGroup Archive 2012

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

Search the Archive

Find Position of many elements in a large list.


I have a sorted, 1-dimensional list X of 1,000,000 integers, and a sorted, 1-dimensional list Y of 10,000 integers.  Most, but not all, of the elements of Y are also elements of X.  I'd like to know the positions of the elements in X that are also in Y.  What's the fastest way to compute this?

I have an algorithm in mind but it requires lots of custom code and I'm wondering if there's a clever way to do it with built-in functions.  Thanks.



  • Prev by Date: Re: Simplify
  • Next by Date: How to use Pick[]; Is this a bug?
  • Previous by thread: Re: Drawing a Line From One Plot to Another
  • Next by thread: Re: Find Position of many elements in a large list.