Hacker News new | ask | show | jobs
by fulafel 567 days ago
From the docs: "The add operation runs in amortized constant time, that is, adding n elements requires O(n) time".

Given the linear time time complexity, it seems obvious that adding a thread pointer to the list won't contribute substantially to the thread creation time.

The way these kinds of operations can be implemented for amortized linear time (also in Python, C realloc, etc) is explained in https://en.wikipedia.org/wiki/Dynamic_array#Geometric_expans...