position of sequence of numbers in list
- To: mathgroup at smc.vnet.net
- Subject: [mg106976] position of sequence of numbers in list
- From: JB <jkerrb at gmail.com>
- Date: Sat, 30 Jan 2010 07:12:04 -0500 (EST)
Hi,
What is the most efficient way to find the position of the beginning
of a sequence of numbers from a list?
I found a couple of ways:
find 3,4 in list={1,2,3,4,5};
1. pos=Intersection[Position[list,3],(Position[list,4])+1]
2. pos=Position[Partition[list,2,1],{3,4}]
Are there other ways to do this?
What is the best way when dealing with large lists?
Thanks,
JB
- Follow-Ups:
- Re: Re: position of sequence of numbers in list
- From: Leonid Shifrin <lshifr@gmail.com>
- Re: position of sequence of numbers in list
- From: Leonid Shifrin <lshifr@gmail.com>
- Re: position of sequence of numbers in list
- From: Leonid Shifrin <lshifr@gmail.com>
- Re: position of sequence of numbers in list
- From: Leonid Shifrin <lshifr@gmail.com>
- Re: position of sequence of numbers in list
- From: DrMajorBob <btreat1@austin.rr.com>
- Re: position of sequence of numbers in list
- From: Patrick Scheibe <pscheibe@trm.uni-leipzig.de>
- Re: Re: position of sequence of numbers in list