An educational project focused on implementing fundamental data structures and algorithms in Python. This repository serves as a learning resource for understanding how core computer science concepts work under the hood.
- Learn by Implementation: Gain deep understanding of data structures and algorithms through hands-on coding
- Educational Focus: Clear, well-documented code that prioritizes learning over performance optimization
- Test-Driven Development: Comprehensive test coverage to ensure correctness and reliability
- Open Source Contribution: Encourage collaborative learning and contributions from the community
- Linked Lists
- Singly Linked List
- Doubly Linked List
- Singly Circular Linked List
- Doubly Circular Linked List
- More coming soon...
- Coming soon...
- Python 3.13 or higher
- Poetry (for dependency management)
-
Clone the repository
git clone https://github.com/yourusername/dsa-python.git cd dsa-python -
Install dependencies using Poetry
poetry install
-
Activate the virtual environment
poetry shell
Run all tests:
poetry run pytestRun tests with verbose output:
poetry run pytest -vRun tests for a specific module:
poetry run pytest tests/test_linked_lists/Run tests with coverage:
poetry run pytest --cov=srcFormat code with Black:
poetry run black src/ tests/Lint with Flake8:
poetry run flake8 src/ tests/Type checking with mypy:
poetry run mypy src/from src.data_structures.linked_lists.singly_linked_list import SinglyLinkedList
# Create a new linked list
ll = SinglyLinkedList()
# Add elements
ll.append(1)
ll.append(2)
ll.append(3)
# Display the list
print(ll) # Output: 1 -> 2 -> 3 -> None
# Access elements
print(ll.get(1)) # Output: 2
# Remove elements
ll.remove(2)
print(ll) # Output: 1 -> 3 -> Nonedsa-python/
βββ src/
β βββ data_structures/
β β βββ linked_lists/
β β βββ singly_linked_list/
β β βββ doubly_linked_list/
β β βββ singly_circular_linked_list/
β β βββ doubly_circular_linked_list/
β βββ algorithms/
βββ tests/
β βββ test_linked_lists/
βββ pyproject.toml
βββ poetry.lock
βββ README.md
- Create a new module in
src/data_structures/ - Implement the data structure with clear documentation
- Add comprehensive tests in
tests/ - Update this README with usage examples
- Create a new module in
src/algorithms/ - Implement the algorithm with clear documentation
- Add comprehensive tests in
tests/ - Update this README with usage examples
This project follows test-driven development principles:
- Unit Tests: Test individual components in isolation
- Integration Tests: Test how components work together
- Property-Based Testing: Use Hypothesis for testing with random inputs
- Performance Tests: Benchmark critical operations
- Python 3.13+: Latest Python features and performance improvements
- graphviz: For visualizing data structures
- ipython: Enhanced interactive Python shell
- jupyter: For interactive notebooks and demonstrations
- matplotlib: For plotting algorithm performance and visualizations
- pytest: Testing framework
- pytest-benchmark: Performance benchmarking
- hypothesis: Property-based testing
- black: Code formatting
- flake8: Linting
- mypy: Type checking
Contributions are welcome! This is an educational project, so clarity and learning value are prioritized over performance optimizations.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Implement your changes with tests
- Ensure all tests pass and code is formatted
- Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Write clear, self-documenting code
- Include comprehensive tests for new features
- Follow the existing code style (use Black for formatting)
- Add docstrings for all public methods and classes
- Update the README if you add new features
- Implement stack and queue data structures
- Add tree structures (Binary Tree, BST, AVL, etc.)
- Implement graph data structures and algorithms
- Add sorting algorithms (Quick Sort, Merge Sort, etc.)
- Add searching algorithms (Binary Search, etc.)
- Create visualization tools for data structures
- Add complexity analysis documentation
- Create Jupyter notebook tutorials
This project is licensed under the MIT License - see the LICENSE file for details.
- Educational resources and algorithm books that inspired this project
- The open-source community for providing excellent tools and libraries
- Contributors who help improve this educational resource
Author: Animesh
Email: [email protected]
This project is created for educational purposes. The implementations prioritize clarity and understanding over performance optimization.