A comprehensive toolkit for Data Structures and Algorithms
Project description
DSA Toolkit ๐
A comprehensive, educational Python toolkit for Data Structures and Algorithms (DSA). Perfect for students, educators, and developers learning or teaching computer science fundamentals.
โจ Features
๐ Core Algorithms
- Sorting: Bubble, Selection, Insertion, Merge, Quick, Heap, Counting, Radix, Shell Sort
- Searching: Linear, Binary (iterative & recursive), Jump, Exponential, Interpolation
- Recursion: Factorial, Fibonacci, Power, GCD, Tower of Hanoi, and more
- Graph Algorithms: DFS, BFS, Dijkstra, and more
๐๏ธ Data Structures
- Stacks: Array-based, Linked List-based, Min Stack
- Queues: Array Queue, Linked List Queue, Circular Queue, Deque, Priority Queue
- Linked Lists: Singly, Doubly, Circular
- Trees: Binary Tree, Binary Search Tree (BST), AVL Tree
๐ฏ Advanced Algorithms
- Greedy: Activity Selection, Fractional Knapsack, Huffman Coding, Job Scheduling
- Divide & Conquer: Advanced sorting, Closest Pair, Strassen's Matrix Multiplication
- Dynamic Programming: 0/1 Knapsack, LCS, LIS, Edit Distance, Coin Change, Matrix Chain Multiplication
๐ง Installation
From PyPI (Recommended)
pip install dsa-toolkit
From Source
git clone https://github.com/masoomverma/dsa-toolkit.git
cd dsa-toolkit
pip install -e .
๐ Quick Start
# Import modules
from dsa import sorting, searching, recursion
from dsa.structures import stack, queue, tree
from dsa.algorithms import greedy, dynamic_programming
# Use sorting algorithms with debug mode
arr = [64, 34, 25, 12, 22, 11, 90]
sorted_arr = sorting.quick_sort(arr, debug=True)
# Work with data structures
s = stack.ArrayStack(debug=True)
s.push(10)
s.push(20)
print(s.pop()) # 20
# Use advanced algorithms
values = [60, 100, 120]
weights = [10, 20, 30]
capacity = 50
max_value, items = greedy.fractional_knapsack(
list(zip(values, weights)),
capacity,
debug=True
)
๐ Usage Examples
Sorting with Debug Mode
from dsa import sorting
arr = [5, 2, 8, 1, 9]
result = sorting.merge_sort(arr, debug=True)
# Outputs step-by-step execution trace
Binary Search Tree
from dsa.structures import tree
bst = tree.BinarySearchTree(debug=True)
for val in [50, 30, 70, 20, 40, 60, 80]:
bst.insert(val)
print(bst.inorder_traversal()) # [20, 30, 40, 50, 60, 70, 80]
print(bst.search(40)) # True
Dynamic Programming
from dsa.algorithms import dynamic_programming
# 0/1 Knapsack Problem
weights = [1, 3, 4, 5]
values = [1, 4, 5, 7]
capacity = 7
max_value, selected_items = dynamic_programming.knapsack_01_tabulation(
weights, values, capacity, debug=True
)
print(f"Maximum value: {max_value}")
Stack Applications
from dsa.structures.stack import is_balanced_parentheses, evaluate_postfix
# Check balanced parentheses
expression = "([{}])"
is_balanced = is_balanced_parentheses(expression, debug=True)
# Evaluate postfix expression
postfix = "3 4 + 2 * 7 /"
result = evaluate_postfix(postfix, debug=True)
๐ Educational Features
Debug Mode
Every algorithm and data structure supports a debug=True parameter that provides:
- Step-by-step execution traces
- Intermediate states and values
- Decision-making processes
- Visual representation of operations
from dsa import sorting
# See exactly how bubble sort works
arr = [5, 1, 4, 2, 8]
sorting.bubble_sort(arr, debug=True)
Comprehensive Documentation
- Detailed docstrings for all functions and classes
- Time and space complexity information
- Real-world use cases and examples
๐ฆ Package Structure
dsa/
โโโ __init__.py
โโโ sorting.py # Sorting algorithms
โโโ searching.py # Searching algorithms
โโโ recursion.py # Recursive algorithms
โโโ graph.py # Graph algorithms
โโโ utils.py # Utility functions
โโโ structures/
โ โโโ __init__.py
โ โโโ stack.py # Stack implementations
โ โโโ queue.py # Queue implementations
โ โโโ linked_list.py # Linked list implementations
โ โโโ tree.py # Tree implementations
โโโ algorithms/
โโโ __init__.py
โโโ greedy.py # Greedy algorithms
โโโ divide_and_conquer.py
โโโ dynamic_programming.py
๐ค Contributing
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Built for educational purposes
- Inspired by classic computer science textbooks
- Designed to help students and developers master DSA concepts
๐ง Contact
Masoom Verma - 0xmasoom@gmail.com
Project Link: https://github.com/masoomverma/dsa-toolkit
๐ Star History
If you find this project helpful, please consider giving it a star โญ!
Happy Learning! ๐โจ
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dsa_toolkit-1.0.1.tar.gz.
File metadata
- Download URL: dsa_toolkit-1.0.1.tar.gz
- Upload date:
- Size: 50.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a0cfdcde8345e66a9a1befe76048a8bf679772b972aabafbc1009e9fb492059
|
|
| MD5 |
5e11e30a84b195db7b75e5fba8adfb47
|
|
| BLAKE2b-256 |
191fbf1f1040186303a9340c9931ae95b281ca87e4aaa921554e8aef3c891e31
|
File details
Details for the file dsa_toolkit-1.0.1-py3-none-any.whl.
File metadata
- Download URL: dsa_toolkit-1.0.1-py3-none-any.whl
- Upload date:
- Size: 50.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b3e700d38902ae663ff76ec8787fc93c4bb5f261ac8eb0b70b39a7306c56b64
|
|
| MD5 |
1e519756df9d2f5dc6d23d68c9b1deb1
|
|
| BLAKE2b-256 |
cc1e36e9230836273fd29457690e9956baf96a9b93cf3edf5dc4c7d46ba9a16d
|