Why is DList insertion log n?

mig09 alb94825 at gmail.com
Mon Feb 17 09:36:49 UTC 2025


On Monday, 17 February 2025 at 03:39:46 UTC, Jonathan M Davis 
wrote:
> On Sunday, February 16, 2025 1:57:58 PM MST rkompass via 
> Digitalmars-d-learn 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) https://vema-star-pt.com/
>> 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
> Actually, the complexity of each of the operations was a key 
> part of the design, but when you're editing the documentation 
> of a bunch of containers with the same or similar operations,


That makes sense. Copy-paste errors are easy to miss, especially 
when dealing with similar APIs.


More information about the Digitalmars-d-learn mailing list