Am Mittwoch, 9. April 2008 22:41:25 schrieb H. Verbeet:
On 09/04/2008, Stefan Dösinger stefan@codeweavers.com wrote:
You usually grow the memory by a factor of the old size because this reduces the number of needed grows. So growing the stack is an O(log(n)) instead of O(n), which is a huge difference.
No, the amortized time per push is O(1). The realloc becomes more expensive as the array gets larger.
Good point