O(1) "popAny" for associative array?
Andrew Klaassen via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Dec 11 10:27:06 PST 2014
In theory, it should be possible to do a "popFront" equivalent
for a hash that has O(1) average complexity, so long as you don't
care about order. I.e., "give me any key from the hash, I don't
care which one, and then delete it from the hash". Is that
correct?
If it is correct, is there any way to do it in D?
Do I assume correctly that "myarray.keys[0]" would not meet the
O(1) requirement?
Thanks.
Andrew
More information about the Digitalmars-d-learn
mailing list