3 ms·
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 s
by fulafel 2y 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_expansion_and_amortized_cost https://en.wikipedia.org/wiki/Dynamic_array#Geometric_expans...