Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: Efficiency of repeatedly appending to a List

  • To: mathgroup at smc.vnet.net
  • Subject: [mg71159] Re: Efficiency of repeatedly appending to a List
  • From: Jon Harrop <jon at ffconsultancy.com>
  • Date: Thu, 9 Nov 2006 03:39:27 -0500 (EST)
  • References: <eisg8h$n5a$1@smc.vnet.net>

Andrew Moylan wrote:
> This caused me to wonder about the efficiency of appending items to
> Lists in Mathematica in general. Is it an O(N) operation (i.e.,
> something akin to a realloc in C)? Or does Mathematica employ some sort
> of anticipatory memory allocation scheme to make adding new elements to
> lists usually faster than O(N)?

I think I tested this a while ago and found it to be amortised constant-time
complexity.

-- 
Dr Jon D Harrop, Flying Frog Consultancy
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists


  • Prev by Date: Re: linux font rotation in graphics & (strange) black graphics borders
  • Next by Date: Help needed
  • Previous by thread: Re: Re: Efficiency of repeatedly appending to a List
  • Next by thread: Re: Efficiency of repeatedly appending to a List