I recently came across some Java code that simply put some strings into a Java TreeSet, implemented a distance based comparator for it, and then made its merry way into the
I recently implemented TreeSet for Python using bisect module.
https://github.com/fukatani/TreeSet
Its usage is similar to Java's Treeset.
ex.
from treeset import TreeSet
ts = TreeSet([3,7,2,7,1,3])
print(ts)
>>> [1, 2, 3, 7]
ts.add(4)
print(ts)
>>> [1, 2, 3, 4, 7]
ts.remove(7)
print(ts)
>>> [1, 2, 3, 4]
print(ts[2])
>>> 3