Skip to content

wfyaibaib/py-algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

py-algorithms

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 An empty red-black tree insert 10 nodes.

About

algorithms and data structures for python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages