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

Red-black tree implementation in Python

Results 8 python-red-black-trees issues
Sort by recently updated
recently updated
newest added

```python bst = RedBlackTree() bst.insert(55) bst.insert(40) bst.insert(58) bst.insert(42) assert bst.successor(bst.search(58)).key is None ``` > while not y.is_null() and x == y.right: E AttributeError: 'NoneType' object has no attribute 'is_null'

A user may wish to extend the Node object, or implement the Node interface within a custom object. The RedBlackTree could be made to accept these objects and organize them...

* Added a `__str__()` to RedBlackTree to aid testing. * Added testing of `Node.__repr__()`

The class has a size attribute so it makes sense to use the standard `__len__()` method to access it instead of relying on it being a public attribute.

The following code: ```python bst = RedBlackTree() bst.insert(1) bst.insert(2) bst.insert(3) bst.print_tree() ``` produces the following output: ``` R---- 2(BLACK) L---- 1(RED) R---- 3(RED) ``` I feel the following would be...

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...

There is a extended UML format that I feel could be used to visualize the tree structure quite well: ``` @startmindmap *[#red] \rotatebox{90}{Root Entry} **[#black] \rotatebox{90}{} **[#black] \rotatebox{90}{\textcolor{white}{PROJECT}} ***[#red] \rotatebox{90}{PROJECTwm}...