Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #11348 > unrolled thread

Re: Find Position of many elements in a large list.

Started byMatthias Bode <lvsaba@hotmail.com>
First post2012-08-15 07:32 +0000
Last post2012-08-15 07:32 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Find Position of many elements in a large list. Matthias Bode <lvsaba@hotmail.com> - 2012-08-15 07:32 +0000

#11348 — Re: Find Position of many elements in a large list.

FromMatthias Bode <lvsaba@hotmail.com>
Date2012-08-15 07:32 +0000
SubjectRe: Find Position of many elements in a large list.
Message-ID<k0fjat$q73$1@smc.vnet.net>
Hola:
INPUT:
list01 = {1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 17}; list02 = {3, 5, 17}; Table[{list02[[n]], Position[list01,        list02[[n]]]}, {n, 3}]
OUTPUT:{{3, {{3}}}, {5, {{5}, {6}}}, {17, {{11}}}}
Atentamente,
MATTHIAS BODE
S 17.35775=B0, W 066.14577=B0
2'740 m
AMSL.




> From: benp84@gmail.com
> Subject: Find Position of many elements in a large list.
> To: mathgroup@smc.vnet.net
> Date: Tue, 14 Aug 2012 04:22:21 -0400
>
> 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.
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web