comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Merits of different ways of 'extending' arrays
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Merits of different ways of 'extending' arrays [message #85912 is a reply to message #85877] Tue, 17 September 2013 12:34 Go to previous messageGo to previous message
Yngvar Larsen is currently offline  Yngvar Larsen
Messages: 134
Registered: January 2010
Senior Member
On Monday, 16 September 2013 15:47:38 UTC+1, suicida...@gmail.com wrote:

> Allocating and expanding in fixed "blocks" as suggested before is a way to elegantly handle this problem, however the block size needs to be tuned for every application or you can start to get some big slowdowns.

In the generic case when "big enough" is not known, the best algorithm is to double the size of the array every time you hit the current capacity. (Or 3x or 1.5x, does not matter as long as the growth is exponential in as a function of the number of resizes.)

See

http://en.wikipedia.org/wiki/Dynamic_array



--
Yngvar
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL X11 forwarding segmentation fault
Next Topic: defining structure after ascii template

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 17:18:43 PDT 2025

Total time taken to generate the page: 0.79800 seconds