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.1.tar.gz (50.1 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.1-py3-none-any.whl (50.6 kB view details)

Uploaded Python 3

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

Hashes for dsa_toolkit-1.0.1.tar.gz
Algorithm Hash digest
SHA256 6a0cfdcde8345e66a9a1befe76048a8bf679772b972aabafbc1009e9fb492059
MD5 5e11e30a84b195db7b75e5fba8adfb47
BLAKE2b-256 191fbf1f1040186303a9340c9931ae95b281ca87e4aaa921554e8aef3c891e31

See more details on using hashes here.

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

Hashes for dsa_toolkit-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6b3e700d38902ae663ff76ec8787fc93c4bb5f261ac8eb0b70b39a7306c56b64
MD5 1e519756df9d2f5dc6d23d68c9b1deb1
BLAKE2b-256 cc1e36e9230836273fd29457690e9956baf96a9b93cf3edf5dc4c7d46ba9a16d

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