Skip to main content

A comprehensive Python package for various data structures and algorithms implementations.

Project description

dsaedge: Data Structures and Algorithms in Python

A comprehensive collection of various data structures and algorithms implemented in Python.

Installation

You can install this package using pip:

pip install dsaedge

Usage

Here are some examples of how to use the implemented data structures and algorithms:

Linked Lists

from dsaedge.linked_lists.singly_linked_list import LinkedList

ll = LinkedList()
ll.append(10)
ll.prepend(5)
print(ll)

Sorting Algorithms

from dsaedge.sorting.sorting_algorithms import Sorting

arr = [64, 34, 25, 12, 22, 11, 90]
sorted_arr = Sorting.bubble_sort(arr[:])
print(sorted_arr)

Searching Algorithms

from dsaedge.searching.searching_algorithms import Searching

arr = [1, 5, 2, 8, 3]
index = Searching.linear_search(arr, 8)
print(f"Element found at index: {index}")

Graph Algorithms

from dsaedge.graphs.graph_representation import Graph

graph = Graph()
graph.add_edge('A', 'B', weight=4)
graph.add_edge('A', 'C', weight=2)

# Example BFS
bfs_result = graph.bfs('A')
print(f"BFS Traversal: {bfs_result}")

# Example Dijkstra
distances, predecessors = graph.dijkstra('A')
print(f"Dijkstra distances from A: {distances}")

Implemented Data Structures and Algorithms

The dsaedge package is organized into several modules, each focusing on a specific category of data structures or algorithms.

Data Structures

  • advanced_data_structures
    • disjoint_set_union.py: Disjoint Set Union (DSU)
    • fenwick_tree.py: Fenwick Tree (Binary Indexed Tree)
    • segment_tree.py: Segment Tree
    • trie.py: Trie (Prefix Tree)
  • hash_tables
    • hash_table.py: Hash Table (with chaining)
  • heaps
    • min_heap.py: Min-Heap
  • linked_lists
    • circular_singly_linked_list.py: Circular Singly Linked List
    • doubly_linked_list.py: Doubly Linked List
    • singly_linked_list.py: Singly Linked List
  • trees
    • avl_tree.py: AVL Tree
    • binary_search_tree.py: Binary Search Tree (BST)
    • binary_tree.py: Generic Binary Tree (with traversals)

Algorithms

  • algorithmic_paradigms
    • kmp_search.py: Knuth-Morris-Pratt (KMP) string searching
    • knapsack_problem.py: Knapsack Problem (Dynamic Programming)
    • longest_common_subsequence.py: Longest Common Subsequence (Dynamic Programming)
    • n_queens.py: N-Queens Problem (Backtracking)
    • sudoku_solver.py: Sudoku Solver (Backtracking)
  • graphs
    • bellman_ford.py: Bellman-Ford Algorithm
    • floyd_warshall.py: Floyd-Warshall Algorithm
    • graph_representation.py: Graph Representation (Adjacency List) and common graph algorithms (BFS, DFS, Dijkstra, Prim, A*, Cycle Detection, SCC)
    • kruskal_algorithm.py: Kruskal's Algorithm
    • topological_sort.py: Topological Sort
  • searching
    • searching_algorithms.py: Linear Search, Binary Search, Jump Search, Exponential Search
  • sorting
    • sorting_algorithms.py: Bubble Sort, Selection Sort, Insertion Sort, Merge Sort, Quick Sort, Heap Sort, Counting Sort, Radix Sort

Contributing

Contributions are welcome! Please feel free to open issues or submit pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

dsaedge-0.3.0.tar.gz (20.5 kB view details)

Uploaded Source

Built Distribution

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

dsaedge-0.3.0-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

Details for the file dsaedge-0.3.0.tar.gz.

File metadata

  • Download URL: dsaedge-0.3.0.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for dsaedge-0.3.0.tar.gz
Algorithm Hash digest
SHA256 380989e32b20cf80a289944efe98aa45771b9a4f830a96e3fddb1285f343f8ee
MD5 d027fd5185d38c451164c75a66887d86
BLAKE2b-256 5e1e60254a5b523745812317ea61a9d879bcc9d750f9a2a5c767becf08512aad

See more details on using hashes here.

File details

Details for the file dsaedge-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: dsaedge-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 27.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for dsaedge-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b6578dd052c81966044a3d0ae015ca8d18f33ad792eee5e7b3a2369d19c3dbf7
MD5 b81687a2deaa3fce195b1dc3bf3e7e3c
BLAKE2b-256 235576849819d5bc58e671f3302eb565d210b8dd0b3f4feeb5a5484c4b9f496b

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