Skip to main content

DSA Learning Library

CI PyPI Python License

Educational implementations of common data structures and algorithms written in clean, typed, idiomatic Python.

⚠️ This project is currently under active development and is primarily intended for learning and educational purposes.

Motivation

This project started as part of my journey to build strong software engineering fundamentals.

The goal is not only to study data structures and algorithms, but also to apply software engineering practices such as:

  • API design
  • Type hints
  • Testing
  • Documentation
  • Packaging
  • Versioning

This repository serves both as:

  • A learning project
  • A reference implementation for my personal knowledge base

Project Goals

This library aims to be:

  1. Easy to use
  2. Easy to extend
  3. Easy to maintain

The primary objective is clarity and educational value.

Implementations are designed to clearly communicate the underlying ideas behind each data structure and algorithm.

Performance and memory optimizations are considered when they help explain the concepts (for example, path compression in Union-Find), but maximum performance is not the primary goal.

Design Principles

Data Structures Own Their Data

Data structures are responsible for storing and managing their internal state.

Examples:

  • LinkedList.append()
  • BinarySearchTree.insert()
  • Graph.add_edge()

Algorithms Are Standalone

Algorithms operate on data structures but are not part of them.

Examples:

  • breadth_first_search(graph)
  • depth_first_search(graph)
  • dijkstra(graph)
  • topological_sort(graph)

This separation keeps data structures focused and makes algorithms reusable.

Explicit and Readable APIs

Public APIs favor clarity over brevity.

Examples:

breadth_first_search(graph)
depth_first_search(graph)
binary_search(array, target)

instead of abbreviated names.

Strong Typing

All public interfaces use Python type hints.

Pythonic Error Handling

Operations raise exceptions when invalid usage occurs rather than silently returning None.

Educational First

The code prioritizes readability and learning value.

Implementation choices should make the underlying concepts easy to understand.

Project Structure

src/
└── dsa/
    ├── algorithms/
    ├── data_structures/
    └── graph/

Implemented Data Structures

Linear Structures

  • Linked List
  • Doubly Linked List
  • Stack
  • Queue
  • Priority Queue

Trees

  • Binary Search Tree
  • Trie

Graph Structures

  • Graph (Adjacency List)

Disjoint Sets

  • Union-Find

Implemented Algorithms

Graph Algorithms

  • Breadth-First Search (BFS)
  • Depth-First Search (DFS)
  • Topological Sort (Kahn)
  • Topological Sort (DFS)
  • Dijkstra
  • Prim
  • Kruskal

Sorting Algorithms

  • Bubble Sort
  • Selection Sort
  • Insertion Sort
  • Merge Sort
  • Quick Sort
  • Heap Sort

Searching Algorithms

  • Binary Search

Testing Philosophy

Every implementation should include tests covering:

  • Happy path scenarios
  • Edge cases
  • Empty inputs
  • Invalid inputs

Usage

Installation:

pip install dsa-study

Installation from source:

git clone https://github.com/pablohernandezdo/dsa-study-library.git
cd dsa-study-library
uv sync

Example:

from dsa.data_structures.linked_list import LinkedList

ll = LinkedList([1, 2, 3])

ll.insert_front(0)   # [0, 1, 2, 3]
ll.insert_back(4)    # [0, 1, 2, 3, 4]
ll.find(3)           # 3
ll.delete(2)         # [0, 1, 3, 4]

Future Work

Type System

  • Learn generic types (TypeVar, Generic)
  • Make data structures generic

Graphs

  • Additional graph representations
  • Weighted graph abstractions

Algorithms

  • Dynamic Programming
  • Greedy Algorithms
  • Backtracking
  • String Algorithms

Tooling

  • Automated testing with GitHub Actions
  • PyPI publication
  • API documentation generation

Versioning

This project follows Semantic Versioning.

Releases are tracked through:

  • pyproject.toml
  • Git tags
  • GitHub releases

Metadata

Release files for dsa-study 0.4.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dsa-study 0.4.5
File Size Uploaded Provenance Actions
dsa_study-0.4.5.tar.gz 33.8 kB With provenance Details for dsa_study-0.4.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dsa-study 0.4.5
File Interpreter ABI Platform Actions
dsa_study-0.4.5-py3-none-any.whl Python 3 none any Details for dsa_study-0.4.5-py3-none-any.whl

Total release size: 41.1 kB

Release files / dsa_study-0.4.5.tar.gz

Download URL dsa_study-0.4.5.tar.gz
Size 33.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1955282d2b945c19cdd878a97a159735b824661bdc58d8f19525b360b3e3b686
BLAKE2b-256 checksum
How to use checksums
5f82a093575b6e1e0000c54562772e1709d91e124dc1ec1bc5cef2d875a8ebdf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 15, 2026.

Transparency log

Release files / dsa_study-0.4.5-py3-none-any.whl

Download URL dsa_study-0.4.5-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
37034b61fde645379b0f54be75a7ca8b7159e5a4c533005811193fd75cb59b07
BLAKE2b-256 checksum
How to use checksums
cb252ac48d474195f4c39f13c01c98a5cebaee895c431b09f8814bb6b281b5c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 15, 2026.

Transparency log

Security for dsa-study 0.4.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dsa_study-0.4.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page