|
|
clipka wrote:
> Of course if someone only considers the cost of insertion, neglecting
> any other costs his algorithm may incur, he's doin' it wrong...
Trolltech gets the numbers wrong even if you insert always at the end.
Amortized O(1) append is only O(1) if you double the size of the array each
time you insert something. It's not O(1) if you add a fixed size to the
array each time (assuming you're copying elements from the old array to the
new array each time, of course).
--
Darren New, San Diego CA, USA (PST)
I ordered stamps from Zazzle that read "Place Stamp Here".
Post a reply to this message
|
|