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

Python Algorithms contains a collection of useful algorithms written in python.

Project Description
Python Algorithms

.. image::

.. image::

.. image::

Python Algorithms contains a collection of useful algorithms written in python.
The algorithms include (but not limited to) topics such as searching, sorting,
graph, and string theory.

This project is inspired from the textbook Algorithms, 4th Edition by Robert
Sedgewick and Kevin Wayne and associated book-site The goal of this book is summarized in the
following excerpt from the book-site:

Our original goal for this book was to cover the 50 algorithms that every
programmer should know. We use the word programmer to refer to anyone
engaged in trying to accomplish something with the help of a computer,
including scientists, engineers, and applications developers, not to mention
college students in science, engineering, and computer science.

However, the algorithms for this project are not meant to be a ported version of
the algorithms found in the book. Efforts should be made to implement those
algorithms from the scratch following Pythonic coding style. Some of the
algorithms are well known and the reference for those algorithms should appear
in the documentation. While, some of the algorithms are very specific and
difficult implement in a different way while maintaining accuracy and
efficiency. Such algorithms appear in the scientific literatures and/or books
and those should be properly referenced as well.


* Mainly for educational purposes, but can be useful in certain practical scenarios as well.
* Consequently, built-in algorithms are avoided as much as possible and detailed
implementation is done from the scratch.
* Preference is given towards a pythonic style rather than sticking to true OOP style.
* Free software: BSD license.
* Documentation:


Here is a list of algorithms divided into packages.

.. Note:: Not all of the algorithms have been fully implemented yet.


A collection of few basic algorithms that do not fit in other packages. Trivial
algorithms and data structures that are built into python are skipped.

* Binary search
* Knuth shuffle
* Stack
* Queue
* Bag
* Union find

:Estimated Release: 0.2.0


Specialized searching algorithms and/or corresponding data structures are included in this package.
Although some of the following data structures, such as Hash, are implemented in python, they have been implemented for demonstration purpose.
Unless, specific needs arise, the built-in data structures should be preferred in production code.

* Red black BST
* Hash

:Estimated Release: 0.3.0


* Insertion
* Selection
* Merge
* Quick
* Quick 3 way
* Shell
* Heap

:Estimated Release: 0.4.0


* Graph
* Directed graph
* BFS paths
* DFS paths
* Topological

:Estimated Release: 0.5.0


* Quick 3 string
* Rabin karp

:Estimated Release: 0.6.0


0.1.0 (2014-02-14)

* First release on PyPI.

0.2.0 (2014-04-15)

* Implemented the following data structures and algorithms:
* Binary search
* Knuth shuffle
* Stack
* Queue
* Bag
* Union find
Release History

Release History

This version
History Node


History Node


History Node


History Node


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
python_algorithms-0.2.2.tar.gz (13.2 kB) Copy SHA256 Checksum SHA256 Source Oct 3, 2015

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