Skip to main content

Dhruv's Lab - A Python library for algorithms and data structures

Project description

DLab - Dhruv's Lab

🧠 DLabX - Dhruv's Lab – Learn, Build, and Master Algorithms

DLabX (Dhruv’s Lab) is a comprehensive Python library for algorithms and data structures. It provides efficient and easy-to-use implementations for sorting, searching, dynamic programming, graph algorithms, backtracking, string matching, and more.

DLabXS is ideal for:

🎓 Students learning algorithms and data structures 🧩 Researchers and educators ⚡ Competitive programmers and developers


📑 Table of Contents

  1. Installation
  2. Usage
  3. Sorting Algorithms
  4. Searching Algorithms
  5. Greedy Algorithms
  6. Dynamic Programming
  7. Backtracking
  8. Brute Force
  9. Divide and Conquer
  10. Data Structures
  11. String Matching
  12. License
  13. Author

Features

  • Sorting Algorithms
  • Searching Algorithms
  • Greedy Algorithms
  • Dynamic Programming
  • Backtracking Algorithms
  • Brute-force Algorithms
  • Divide and Conquer Algorithms
  • Data Structures(arrays, stacks, queues, linked lists, trees, graphs)
  • String Matching Algorithms

🚀 Installation

pip install dlabx

🧩 How To Use Dlab:

Import the library: import dlabx as ds

⚙️ Sorting Algorithms Example

arr = [5, 2, 9, 1, 5] sorted_arr = ds.Bubble_Sort(arr) print("Bubble Sort:", sorted_arr)

ds.Bubble_Sort(arr) ds.Selection_Sort(arr) ds.Insertion_Sort(arr) ds.Quick_Sort(arr) ds.Merge_Sort(arr) ds.Heap_Sort(arr) ds.Counting_Sort(arr) ds.Radix_Sort(arr) ds.Shell_Sort(arr) ds.Cocktail_Shaker_Sort(arr) ds.Comb_Sort(arr) ds.Gnome_Sort(arr) ds.Cycle_Sort(arr)

🔍 Searching Algorithms Example

index = ds.Binary_Search([1,2,3,4,5], 3) print("Binary Search:", index)

arr = [1, 2, 3, 4, 5, 6, 7] target = 5

ds.Linear_Search(arr, target) ds.Binary_Search(arr, target) ds.Interpolation_Search(arr, target) ds.Exponential_Search(arr, target) ds.Jump_Search(arr, target) ds.Ternary_Search(arr, target) ds.Fibonacci_Search(arr, target)

Graph Searches

g = ds.Graph(3) g.add_edge(0, 1) g.add_edge(1, 2) ds.Bfs(g, 0) ds.Dfs(g, 0)

💰 Greedy Algorithm Example

edges = [(0,1,10), (0,2,6), (1,2,5)] mst = ds.Kruskal_Mst(3, edges) print("Kruskal MST:", mst)

edges = [(0,1,10), (0,2,6), (1,2,5)] ds.Kruskal_Mst(3, edges)

graph = [[0, 2, 0], [2, 0, 3], [0, 3, 0]] ds.Prim_Mst(graph)

graph = [[0, 4, 0], [4, 0, 8], [0, 8, 0]] ds.Dijkstra(graph, 0)

edges = [(0,1,4),(0,2,5),(1,2,-2)] ds.Bellman_Ford(3, edges, 0)

values = [60, 100, 120] weights = [10, 20, 30] capacity = 50 ds.Fractional_Knapsack(values, weights, capacity)

🧮 Dynamic Programming

ds.Longest_Common_Subsequence("AGGTAB","GXTXAYB")

ds.Longest_Palindromic_Subsequence("abacdfgdcaba")

ds.Edit_Distance("kitten","sitting")

ds.Knapsack_01([60,100,120],[10,20,30],50)

ds.Unbounded_Knapsack([60,100,120],[10,20,30],50)

ds.Subset_Sum([3,34,4,12,5,2], 9)

ds.Can_Partition([1,5,11,5])

ds.Unique_Paths(3,7)

ds.Min_Path_Sum([[1,3,1],[1,5,1],[4,2,1]])

ds.Longest_Increasing_Path([[9,9,4],[6,6,8],[2,1,1]])

ds.Matrix_Chain_Order([10,20,30,40])

ds.Optimal_Bst([10,12,20], [34,8,50], 3)

ds.Catalan_Numbers(5)

ds.Bell_Numbers(5)

ds.Count_Paths([[0,0,0],[0,0,0]])

♟️ Backtracking Algorithms

ds.N_Queens(4)

ds.Sudoku([[5,3,0,0,7,0,0,0,0], ...])

ds.Maze([...])

ds.Generate_Permutations([1,2,3])

ds.Generate_Combinations([1,2,3],2)

ds.Subset_Sum([1,2,3,4],5)

ds.Knights_Tour(8)

ds.Exist_Word([...],"word")

ds.Hamiltonian_Path([...])

ds.Graph_Coloring([...],3)

ds.Partition_Array([...])

ds.K_Coloring([...],3)

ds.Sum_Of_Subsets([...],10)

ds.Generate_Power_Set([1,2,3])

ds.Partition_Into_K_Subsets([1,2,3,4],2)

🧠 Brute-force Algorithms

ds.Generate_Permutations([1,2,3])

ds.Generate_Subsets([1,2,3])

ds.Naive_Search("pattern","text")

ds.Distance([...])

ds.Tsp_Brute_Force([...])

ds.Knapsack_Bruteforce([...])

⚡ Divide and Conquer Algorithms

ds.Strassen_Matrix_Multiplication([[1,2],[3,4]], [[5,6],[7,8]])

ds.Closest_Pair_Of_Points([...])

ds.Fft([...])

ds.Karatsuba(1234,5678)

ds.Convex_Hull([...])

ds.Maximum_Subarray([...])

🧱 Data Structures

Stack

stack = ds.Stack() stack.push(10) stack.pop()

Queue

queue = ds.Queue() queue.enqueue(1) queue.dequeue()

Linked Lists

sll = ds.SinglyLinkedList() dll = ds.DoublyLinkedList() cll = ds.CircularLinkedList()

Trees

bst = ds.BinarySearchTree() avl = ds.AVLTree() rbt = ds.RedBlackTree() trie = ds.Trie() nary = ds.NAryTree()

Graphs

graph = ds.Graph(3) weighted = ds.WeightedGraph(3) bipartite = ds.BipartiteGraph()

🔡 String Matching Algorithms

text = "ABABDABACDABABCABAB" pattern = "ABABCABAB"

ds.Kmp_Search(text, pattern)

ds.Rabin_Karp_Search(text, pattern)

ds.Boyer_Moore_Search(text, pattern)

ds.Boyer_Moore_Horspool_Search(text, pattern)

ds.Ahocorasick_Search([...], pattern)

ds.Bitap_Search(text, pattern)

ds.Finite_Automaton_Search(text, pattern)

ds.Z_Array_Search(text, pattern)

ds.Suffix_Array_Search(text, pattern)

ds.Suffix_Automaton_Search(text, pattern)

ds.Suffix_Tree_Search(text, pattern)

ds.Streaming_Pattern_Matcher_Search(text, pattern)

ds.Sunday_Search(text, pattern)

ds.Wumanber_Search(text, pattern)

🧾 License Licensed under the MIT License.

👨‍💻 Author Dhruv Sonani Creator of DLab - Dhruv’s Lab

📧 Email: dhruvsonani788@gmail.com 🌐 GitHub: https://github.com/dhruv-005

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

dlabx-0.1.0.tar.gz (43.0 kB view details)

Uploaded Source

Built Distribution

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

dlabx-0.1.0-py3-none-any.whl (69.9 kB view details)

Uploaded Python 3

File details

Details for the file dlabx-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for dlabx-0.1.0.tar.gz
Algorithm Hash digest
SHA256 93c31bec6701bbe79df504f4a7e3b279b6556f7bb93bb99df688ce5970a4bbd3
MD5 7378749f5f58c2aa5e5a998301a14fdb
BLAKE2b-256 d64b08a1e074e2ae4d12de97315e4de080dd4cac9bb8dec69c80f106a148821c

See more details on using hashes here.

File details

Details for the file dlabx-0.1.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for dlabx-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 04bfd2edbd5f7fcdfabe7d353598c40099577cdf4e4fdc25ca6b2c0f63c120f0
MD5 e7c507809391fe3ce3c464f84bd7beaf
BLAKE2b-256 5a6a0c25157a4971abdcd6ee2c26afe60104c30b2a3824a76f7be733a287e434

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