MathGroup Archive 2010

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

Search the Archive

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


  • Prev by Date: Re: More memory-efficient inner product for large last
  • Next by Date: Problem with ContourPlot3D
  • Previous by thread: Re: Re: Re: Re: More /.{I->-1}
  • Next by thread: Re: position of sequence of numbers in list