Why is DList insertion log n?

Nick Treleaven nick at geany.org
Mon Feb 17 14:43:27 UTC 2025


On Sunday, 16 February 2025 at 20:57:58 UTC, rkompass wrote:
> From the source code at 
> [https://github.com/dlang/phobos/blob/master/std/container/dlist.d#L784](https://github.com/dlang/phobos/blob/master/std/container/dlist.d#L784)
> I would say it is O(1), as you expected.
> So the docs you refer to seem to be not correct in this case. I 
> assume the complexity info did not have the highest priority at 
> creation of the docs. Rather attention was on the usage details.

Fix to match `SList.insertFront` complexity docs:
https://github.com/dlang/phobos/pull/10638


More information about the Digitalmars-d-learn mailing list