Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualDeprecated

Posted 03 January 2012 - 09:03 PM

(A standard implementation of) dynamic arrays are usually pretty slow at inserting and/or removing elements from the middle of the list as all data has to be copied. Although they are really fast for iteration and lookup. Depending on your definition of a lot you might want to initialize the dynamic array so you don't end up doubling a dynamic array containing 20M elements in the middle of an update.

(A standard implementation of) lists are pretty fast at inserting and/or removing elements anywhere in the list. Although they are not as fast when it comes to iteration and slow (in comparison) to arrays when it comes to lookup.

Depending on how you're using the container you'll get different results, although it's impossible to tell from the description you gave. Although if you want to analyze the performance of your program based on the type of container used you can find the complexity of each operation at wikipedia, or you could simply change the type of container and time your functions.

Edit: been working too much with python lately, a standard implementation of arrays are of course fixed size.

#2Deprecated

Posted 03 January 2012 - 08:44 PM

(A standard implementation of) arrays are usually pretty slow at inserting and/or removing elements from the middle of the list as all data has to be copied. Although they are really fast for iteration and lookup. Depending on your definition of a lot you might want to initialize the array so you don't end up doubling an array containing 20M elements in the middle of an update.

(A standard implementation of) lists are pretty fast at inserting and/or removing elements anywhere in the list. Although they are not as fast when it comes to iteration and slow (in comparison) to arrays when it comes to lookup.

Depending on how you're using the container you'll get different results, although it's impossible to tell from the description you gave. Although if you want to analyze the performance of your program based on the type of container used you can find the complexity of each operation at wikipedia, or you could simply change the type of container and time your functions.

#1Deprecated

Posted 03 January 2012 - 08:37 PM

(A standard implementation of) arrays are usually pretty slow at inserting and/or removing elements from the middle of the list as all data has to be copied. Although they are really fast for iteration and lookup. Depending on your definition of a lot you might want to initialize the array so you don't end up doubling an array containing 20M elements in the middle of an update.

(A standard implementation of) lists are pretty fast at inserting and/or removing elements anywhere in the list. Although they are not as fast when it comes to iteration and slow (in comparison) to arrays when it comes to lookup.

PARTNERS