Re: Algorithm Analysis Course: Should I use Mathematica for projects? //oops, typos

*To*: mathgroup at smc.vnet.net*Subject*: [mg127288] Re: Algorithm Analysis Course: Should I use Mathematica for projects? //oops, typos*From*: Richard Fateman <fateman at cs.berkeley.edu>*Date*: Sat, 14 Jul 2012 01:29:28 -0400 (EDT)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*Delivered-to*: mathgroup-newout@smc.vnet.net*Delivered-to*: mathgroup-newsend@smc.vnet.net

On 7/12/2012 11:57 PM, Richard Fateman wrote: Sorry, some errors crept into my demo examples as I tried to simplify them for inclusion in the email... > > An example. > > Create 3 arrays. > > A=Table[i,{i,0,100}]; > B=Table[i,{i,0,1000}]; > Q=Table[i,{i,0,10000}]; > > Try updating the 50th element of each of these items, which look like > arrays in Mathematica. > > Timing [A[[50]],{i,0,100000}] Should be Timing[Do[A[[50]]++, {i, 0, 100000}]]. My computer reports 0.281 sec > > Timing [B[[50]],{i,0,100000}] Should be B[[5]]=j; Timing[Do[B[[50]]++, {i, 0, 100000}]]. My computer reports 1.266 sec > > Timing [Q[[50]],{i,0,100000}] Should be Timing[Do[Q[[50]]++, {i, 0, 100000}]]. My computer reports 0.421 sec > Apologies for sowing confusion unnecessarily. RJF