Re: SsssComplement?
- To: mathgroup at smc.vnet.net
- Subject: [mg37866] Re: SsssComplement?
- From: Erich Mueller <emueller at mps.ohio-state.edu>
- Date: Fri, 15 Nov 2002 01:36:35 -0500 (EST)
- Organization: Ohio State University
- References: <ar00gn$b6h$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
The following function is pretty fast: UnsortedComplement2[x_List, y__List] := Module[{f}, f[a_] = a; (f[#] = Sequence[]) & /@ Join[y]; f /@ x] Erich On Thu, 14 Nov 2002, Mozalev Vasil wrote: > Hi. Excuse me for poor-quality English language. > My question about "Complement" and "UnsortedComplement". > Function " UnsortedComplement [list, listi] " working more slowly then > function " Complement > [list, listi] " because deletes elements "listi" behind many passes, whereas > " Complement [list, > listi] " it makes for one pass. > What kind of procedure I can use to write " SssssComplement [list, list1] " > for maintenance of > removal elements "list1" from "list" without sorting, but for one pass? > The specified lists already are sorted before their processing by function " > SssssComplement > [list, list1] ". > It is necessary for acceleration of accounts. > Example for check of correctness of work of required function: > SssssComplement [{1,3,5,7,10}, {3, 7,10}] should give > {1,5}. > But > SssssComplement [{1,3,5,7,10}, {7,3,10}] should give > {1,3,5}, as for one pass the number 3 will not leave. > Thank you. > Vasil. > > > > > > > >