Skip to main content

A professional and well-documented data structures package for Python.

Project description

dscollections

dscollections is a professional, educational, and production-friendly Python package that provides commonly used Data Structures and Algorithms (DSA) building blocks.

Author: Sanjay Saravanan M.Tech (IIT Madras)

Why dscollections?

  • Clean and consistent APIs.
  • Strong type hints for better IDE support.
  • Thorough inline documentation.
  • Easy to install and publish on PyPI.
  • Tested with pytest.

Included Data Structures

Linear

  • DynamicArray[T]
  • Stack[T]
  • Queue[T]
  • Deque[T]
  • SinglyLinkedList[T]

Trees

  • BinarySearchTree[T]

Graphs

  • Graph[T] (adjacency-list based)

Priority Structures

  • MinHeap[T]

Installation

pip install dscollections

For local development:

pip install -e .[dev]

Quick Start

from dscollections import Stack, Queue, BinarySearchTree

stack = Stack[int]()
stack.push(10)
stack.push(20)
print(stack.pop())   # 20

queue = Queue[str]()
queue.enqueue("a")
queue.enqueue("b")
print(queue.dequeue())  # "a"

bst = BinarySearchTree[int]()
for value in [10, 5, 15, 12]:
    bst.insert(value)

print(12 in bst)          # True
print(list(bst.in_order()))  # [5, 10, 12, 15]

Publishing to PyPI

  1. Build distributions:
    python -m pip install --upgrade build
    python -m build
    
  2. Upload to TestPyPI:
    python -m pip install --upgrade twine
    twine upload --repository testpypi dist/*
    
  3. Upload to PyPI:
    twine upload dist/*
    

Project Layout

src/dscollections/
  __init__.py
  linear.py
  tree.py
  graph.py
  heap.py
tests/

License

MIT License

Project details


Download files

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

Source Distribution

pydscollections-0.1.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydscollections-0.1.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file pydscollections-0.1.0.tar.gz.

File metadata

  • Download URL: pydscollections-0.1.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for pydscollections-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d0836c21023ca5898a74285bd5ac62a7febedd77012c424627bbc34c9d292ed9
MD5 d13419e5fda8215e4500191f9e211747
BLAKE2b-256 034ca4a77b3467affca3e406b0b2a0a25567f5a9f72d4fd220dc7e2974cafe82

See more details on using hashes here.

File details

Details for the file pydscollections-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pydscollections-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 77133ce1a8e0ac5ed6283b703990d717b01bd6ec8c7a2b3d9fde25bc5dcfc426
MD5 aab5f36c138e346ed994977079b0d98e
BLAKE2b-256 4eb36d9be4e2aa6a17d8efd2df14f7f0d7fb2307d97a414182e518c6ec842741

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page