Re: Re: Need a nice way to do this
- To: mathgroup at smc.vnet.net
- Subject: [mg40322] Re: [mg40310] Re: Need a nice way to do this
- From: Dr Bob <majort at cox-internet.com>
- Date: Tue, 1 Apr 2003 04:51:31 -0500 (EST)
- References: <200303310901.EAA21691@smc.vnet.net>
- Reply-to: majort at cox-internet.com
- Sender: owner-wri-mathgroup at wolfram.com
Here's a timing for that: n = 10000; test = Array[Random[Integer] &, n]; Timing[drbob[test];] Timing[drbob2[test];] Timing[drbob3[test];] Timing[drbob4[test];] Timing[andrzej2[test];] Timing[deLouis[test];] {0.0779999999999994*Second, Null} {0.125*Second, Null} {0.125*Second, Null} {0.0940000000000003*Second, Null} {0.06299999999999972*Second, Null} {0.8120000000000003*Second, Null} and another: n = 10000; test = Array[Round[20Random[]] &, n]; Timing[drbob[test];] Timing[drbob2[test];] Timing[drbob3[test];] Timing[drbob4[test];] Timing[deLouis[test];] {0.07800000000000029*Second, Null} {0.125*Second, Null} {0.14000000000000057*Second, Null} {0.0940000000000003*Second, Null} {0.391*Second, Null} Bobby On Mon, 31 Mar 2003 04:01:08 -0500 (EST), Dana DeLouis <delouis at bellsouth.net> wrote: > I'm new at this, but I'll take a shot: > > s = {a, b, b, a, a, a, b, a, b, a, a}; > > Table[j - Count[Take[s, j], s[[j]]], {j, Length[s]}] > > {0, 1, 1, 2, 2, 2, 4, 3, 5, 4, 4} > -- majort at cox-internet.com Bobby R. Treat