Skip to main content

A comprehensive toolkit for Data Structures and Algorithms

Project description

DSA Toolkit ๐Ÿš€

Python Version License: MIT PyPI version

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:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. 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


Download files

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

Source Distribution

dsa_toolkit-1.0.0.tar.gz (47.2 kB view details)

Uploaded Source

Built Distribution

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

dsa_toolkit-1.0.0-py3-none-any.whl (51.1 kB view details)

Uploaded Python 3

File details

Details for the file dsa_toolkit-1.0.0.tar.gz.

File metadata

  • Download URL: dsa_toolkit-1.0.0.tar.gz
  • Upload date:
  • Size: 47.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for dsa_toolkit-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9df94761615e6391af569c88a4d8109fae8dd6af1b59a9b85b5d10f6f33974fe
MD5 a08f4501d628a8ddcf513e73f8f4d6b5
BLAKE2b-256 be40d11f9e8ced21d5fdc51998c03e36de4eac06300c3f6b2f33d1107eee7692

See more details on using hashes here.

File details

Details for the file dsa_toolkit-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: dsa_toolkit-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 51.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for dsa_toolkit-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b847db31c32f5458b9a183c3a01a9d5195622f31bde62ec28eaa0e0be1760e53
MD5 52e0391886da0e455fbc56e690f3a5dc
BLAKE2b-256 c7345c1a3f40e6877ffb3cdbff2885375f55132b472926006625714dccb579e4

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