emilydolson / python-red-black-trees

Red-black tree implementation in Python
Other
20 stars 5 forks source link

Descriptive interface #3

Closed Beakerboy closed 1 year ago

Beakerboy commented 1 year ago

Adding a descriptive interface to the Node class. This allows us to hide the implementation details from the user. For example, the user does not need to remember that 0 is black and 1 is red. The Microsoft red-black tree that I'm implementing against uses 0 for red and 1 for black.

This is a non-breaking change. I modified the tests to use this new interface, and created new tests for the new methods, but the old tests should all still pass on the new code.

The next few PR will be "non-breaking" in that tests will still pass, but method signatures will be changing, so they kind of are.

There's a lot of separate commits here, so feel free to squash and merge if you want to keep the history cleaner. I tend to use Githib as my API, so every little change winds up becoming its own commit.

emilydolson commented 1 year ago

Thanks! This is definitely a nicer interface.