Find Position of many elements in a large list.
- To: mathgroup at smc.vnet.net
- Subject: [mg127670] Find Position of many elements in a large list.
- From: benp84 at gmail.com
- Date: Tue, 14 Aug 2012 04:22:21 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
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.
- Follow-Ups:
- Re: Find Position of many elements in a large list.
- From: Bob Hanlon <hanlonr357@gmail.com>
- Re: Find Position of many elements in a large list.
- From: Tomas Garza <tgarza10@msn.com>
- Re: Find Position of many elements in a large list.
- From: Matthias Bode <lvsaba@hotmail.com>
- Re: Find Position of many elements in a large list.