Skip to content

py-ds-academy

PyPI - Version PyPI - License CI status PyPI - Python Version

Data structures implemented from scratch for learning and experimentation


๐ŸŽฏ About

py-ds-academy is a comprehensive collection of classic data structures implemented from scratch in Python. The goal is learning + correctness (with tests), not squeezing out every last micro-optimization.

This project serves as both a learning resource and a reference implementation for common data structures used in computer science and software engineering.

โœจ Features

  • ๐Ÿงฑ Core Data Structures - Stacks, queues, linked lists, trees, and heaps
  • ๐Ÿ“ Type Hints - Full type annotations for better code clarity
  • ๐Ÿงช Comprehensive Tests - TDD-first approach with pytest
  • ๐Ÿ“š Well Documented - Clear APIs with complexity notes
  • ๐ŸŽ“ Educational - Perfect for learning data structures

๐Ÿš€ Quick Start

# Install dependencies
uv sync

# Run tests
uv run pytest

# Try it out
uv run python
>>> from py_ds import Stack, Queue, MinHeap, BinarySearchTree

>>> # Stack example
>>> s = Stack([1, 2, 3])
>>> s.pop()
3

>>> # Queue example
>>> q = Queue([1, 2, 3])
>>> q.dequeue()
1

>>> # Heap example
>>> h = MinHeap([3, 1, 4, 1, 5])
>>> h.pop()
1

๐Ÿ“ฆ Implemented Data Structures

Linear Structures

  • โœ… Stack - LIFO stack with list backing
  • โœ… Queue - FIFO queue with list backing
  • โœ… LinkedList - Single-direction linked list
  • โœ… DoublyLinkedList - Double-direction linked list

Trees

  • โœ… BinaryTree - Generic binary tree with multiple traversal methods
  • โœ… BinarySearchTree - Binary search tree with insert, remove, search
  • โœ… AVLTree - Self-balancing AVL tree

Heaps

  • โœ… MinHeap - Minimum binary heap
  • โœ… MaxHeap - Maximum binary heap

๐ŸŽ“ Learning Resources

This project is designed to help you:

  • Understand how data structures work under the hood
  • Learn time and space complexity analysis
  • Practice clean code and type hints
  • See real-world implementations with tests

๐Ÿ“š Documentation

Explore the documentation to learn more:

๐Ÿค Contributing

Contributions are welcome! See the Contributing Guide for details.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


Made with โค๏ธ by Eytan Ohana