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.
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
This library aims to be:
- Easy to use
- Easy to extend
- 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.
Data structures are responsible for storing and managing their internal state.
Examples:
LinkedList.append()BinarySearchTree.insert()Graph.add_edge()
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.
Public APIs favor clarity over brevity.
Examples:
breadth_first_search(graph)
depth_first_search(graph)
binary_search(array, target)instead of abbreviated names.
All public interfaces use Python type hints.
Operations raise exceptions when invalid usage occurs rather than silently returning None.
The code prioritizes readability and learning value.
Implementation choices should make the underlying concepts easy to understand.
src/
└── dsa/
├── algorithms/
├── data_structures/
└── graph/
- Linked List
- Doubly Linked List
- Stack
- Queue
- Deque
- Priority Queue
- Hash Map Chaining
- Hash Map Open Addressing
- Hash Set
- Binary Heap
- Binary Search Tree
- Trie
- Graph (Adjacency List)
- Union-Find
- Breadth-First Search (BFS)
- Depth-First Search (DFS)
- Topological Sort (Kahn)
- Topological Sort (DFS)
- Dijkstra
- Prim
- Kruskal
- Bubble Sort
- Selection Sort
- Insertion Sort
- Merge Sort
- Quick Sort
- Heap Sort
- Binary Search
Every implementation should include tests covering:
- Happy path scenarios
- Edge cases
- Empty inputs
- Invalid inputs
Installation:
pip install dsa-study
Installation from source:
git clone https://github.com/pablohernandezdo/dsa-study-library.git
cd dsa-study-library
uv syncExample:
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]- Learn generic types (
TypeVar,Generic) - Make data structures generic
- Additional graph representations
- Weighted graph abstractions
- Dynamic Programming
- Greedy Algorithms
- Backtracking
- String Algorithms
- Automated testing with GitHub Actions
- PyPI publication
- API documentation generation
This project follows Semantic Versioning.
Releases are tracked through:
pyproject.toml- Git tags
- GitHub releases