python-red-black-trees icon indicating copy to clipboard operation
python-red-black-trees copied to clipboard

Usage as a backend for a SET-like datastructure

Open thestics opened this issue 1 year ago • 1 comments

I want to use your implementation for my data structure. In particular set would behave like this:

s = set()
s.add(1)
s.add(2)

# Logarithmic search
one_present = 1 in s

# Only one 2 is present
s.add(2)

As you might notice, in this case, the insertion of an already existing Node would just override the existing one, not insert it somewhere else. Do you think this is a useful addition and should I create a PR with that patch, or you're fine with the current implementation?

Cheers!

thestics avatar Jul 06 '23 22:07 thestics