Red Black Tree based Dict in Python

895 views Asked by At

I'm trying to use python build a Curve class. In my design, the underlying set of points is better to be implemented in an ordered dict, just like what I have done in C++ with (ordered) map based on the red black tree (RBT). The benefits are a lot, no duplicated points, and the points are ordered by x-axis very well, etc.

While I found in python, both the OrderedDict and the new Dict (after 3.6) are just ordered by the insert order, rather than the data itself. So is there any good method to make the REAL ordered dict in python? RBT is not necessary, but I think this implementation might be a good answer. Or maybe you can convince me another design of the Curve is good either?

0

There are 0 answers