Proposed implementation for an Ordered Dictionary

Paul Rubin http
Fri Feb 27 04:00:46 EST 2009


bearophileHUGS at lycos.com writes:
> So using the XOR (or subtraction) trick to use only 1 pointer for
> each key-value may be useful to keep performance not too much far
> from the normal python dicts: http://en.wikipedia.org/wiki/XOR_linked_list

I don't see how to delete a randomly chosen node if you use that
trick, since the hash lookup doesn't give you two consecutive nodes
in the linked list to xor together.  Maybe you could do something
intricate with skip lists and end up with O(log n) deletion.



More information about the Python-list mailing list