MathGroup Archive 2004

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

Search the Archive

Re: faster sublist checking

  • To: mathgroup at smc.vnet.net
  • Subject: [mg48691] Re: faster sublist checking
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Thu, 10 Jun 2004 02:44:26 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <ca6hlt$fgj$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

In[]:=A = {3, 4, 5}; B = {1, 2, 3, 4, 5, 6, 7};

In[]:=SublistQ[lst_List, {sub__}] := MatchQ[lst, {__, sub, ___}]

In[]:=SublistQ[B, A]
Out[]=True

I don't know if it is the fastest but probably the shortest.

Regards
  Jens

giorgio borghi wrote:
> 
> which is the faster implementantion of function that checks if a list
> A is a sublist of B. es:  A={3,4,5} B={1,2,3,4,5,6,7} gives True?


  • Prev by Date: Re: Combining plots
  • Next by Date: Re: PlotPoints in plot
  • Previous by thread: faster sublist checking
  • Next by thread: RE: faster sublist checking