Algorithms and data structures for python. I also have a c++ version, tf-lib This project is aim to make the way to learn algorithms and data structures easy!
Here is a example for red-black tree:
>>> from rbtree import *
>>> tree = Rbtree()
>>> tree.insert_data_list(range(10))
>>> tree.tree_shape()
[None]
(9, r)
[None]
(8, b)
[None]
(7, r)
[None]
(6, b)
[None]
(5, b)
[None]
(4, b)
[None]
(3, b)
[None]
(2, b)
[None]
(1, b)
[None]
(0, b)
[None]
>>> tree.render('rbtree')
>>>After call the render method , you will get a 'rbtree.png' file in the current working directory.
The render method require that you have install the python GraphViz package, called graphviz.
graphviz