This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!
Project Description


PyBST implements Binary Trees, AVL Trees, Splay Trees, and Red Black Trees in Python. Furthermore, PyBST provides a module for plotting these trees using networkx and matplotlib.

Tree Classes Provided:

  • BSTree - represents an unbalanced Binary Search Tree
  • AVLTree - represents a balanced AVL Tree
  • SplayTree - represents an adjusted Splay Tree
  • RBTree - represents a balanced Red Black Tree


Let Tree represent one of the provided tree classes mentioned above.

  • Tree() - > Creates a new empty tree
  • Tree(seq) -> Creates a new empty tree from seq [(key1,val1),(key2,val2),…,(keyn,valn)]


Tree Methods:

  • is_valid() -> Produces True if Tree is a valid tree of its type, else False.
  • preorder() -> Produces a sequence of the Nodes in Tree in preorder.
  • inorder() -> Produces a sequence of the Nodes in Tree in inorder.
  • postorder() -> Produces a sequence of the Nodes in Tree in postorder.
  • levelorder() -> Produces a sequence of the Nodes in Tree in levelorder.
  • get_node(key) -> Produces the Node in Tree with key attribute key.
  • insert(key,val) <==> Tree[key] = value. Inserts a new Node with key attribute key and value attribute val into Tree.
  • insert_from(seq) -> Inserts keys and values from seq [(key1,val1),(key2,val2),…,(keyn,valn)] into Tree.
  • get_max() <==> max(Tree). Produces the Node with the maximum key in Tree.
  • get_min() <==> min(Tree). Produces the Node with the minimum key in Tree.
  • get_element_count <==> len(Tree). Produces the number of elements in Tree.
  • get_height() -> Produces the height of Tree.
  • delete(key) <==> del Tree[key]. Deletes the Node with key attribute key from Tree.
  • delete_from(seq) -> Deletes Nodes with keys from seq [key1,key2,…,keyn] from Tree.

Plotting Methods (draw Module):

  • plot_tree(Tree) -> Provides a visual representation of Tree via plotting it using networkx and matplotlib.


PyBST requires no external dependencies for the tree classes and their methods themselves. However, note that the following packages are required for tree plotting:




From source:

python install

Using easy install:

easy_install pybst

Alternatively download one of the build distributions found under Downloads.


See PyBST’s github repository at:

Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pybst-1.0.tar.gz (11.7 kB) Copy SHA256 Checksum SHA256 Source Jan 9, 2013
PyBST-1.0.win32.msi (163.8 kB) Copy SHA256 Checksum SHA256 2.7 Windows MSI Installer Jan 9, 2013 (19.2 kB) Copy SHA256 Checksum SHA256 Source Jan 9, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting