Skip to main content

Various data structures and algorithms.

Project description




py_alg_dat is a collection of data structures and algorithms written in Python. The purpose of the code is to show how many of the abstract data types (ADTs) and algorithms being thought in Computer Science courses can be realised in Python.

My primary focus has been to write a library which presents a clear implementation of the various data structures and algorithms and how they can be used. This means that I have made a conscious tradeoff where clarity of the code outweighs subtle and exotic implementation constructs.

The library has mostly been implemented as a recreational project and should as such not be used in production code, since most of the data structures and algorithms are already available in the standard Python library. However, writing software that is robust, performs well, and is easy to maintain requires knowledge of data structures and algorithms. Therefore, implementing and experimenting with these provides valuable knowledge about the inner workings and implementation details found in such stardard libraries.


Data structures included in the library

  • Dynamic array
  • Stack
  • Queue
  • BinaryHeap - MinHeap - MaxHeap
  • LinkedList - Singly linked list - Doubly linked list
  • Partition/Union-Find
  • Graph - Directed - Undirected - Directed weighted - Undirected weighted

Additionally, the library contains the most common algorithms and operations needed when working with these data structures.


The library is selfcontained and does not have any external dependencies. py_alg_dat should run on any platform with Python 2.7 or above.


To install the py_alg_dat library execute the following command in the raptor directory:

$ python install


Besides the unit tests py_alg_dat has a collection of functional test examples which shows how the library can be used from a client’s perspective.

The examples can be found in the ‘examples’ folder in the raptor directory.


The py_alg_dat API contains Docstrings for all classes and methods. Additional documentation about the library can be found in the ‘docs’ folder in the raptor directory.


py_alg_dat is published under the MIT License. The copyright and license are specified in the file “LICENSE.txt” in the raptor directory.


Brian Horn,

Project details

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page