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 import Sorting

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

Searching Algorithms

from dsaedge.searching 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 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

Data Structures

  • Linked Lists
    • Singly Linked List
    • Doubly Linked List
    • Circular Singly Linked List
  • Trees
    • Binary Tree (with traversals)
    • Binary Search Tree (BST)
    • AVL Tree
  • Heaps
    • Min-Heap
  • Hash Tables
    • Hash Table (with chaining)
  • Graphs
    • Adjacency List Representation (Graph class with all graph algorithms as methods)
    • Fenwick Tree (Binary Indexed Tree)
    • Segment Tree
    • Trie (Prefix Tree)
    • Disjoint Set Union (DSU)

Algorithms

  • Graph Algorithms (as methods of Graph class)
    • Breadth-First Search (BFS)
    • Depth-First Search (DFS)
    • Dijkstra's Algorithm
    • Prim's Algorithm
    • Bellman-Ford Algorithm
    • Kruskal's Algorithm
    • Floyd-Warshall Algorithm
    • Topological Sort
    • A* Search
    • Cycle Detection (Undirected and Directed)
    • Strongly Connected Components (Tarjan's Algorithm)
  • Sorting Algorithms (as static methods of Sorting class)
    • Bubble Sort
    • Selection Sort
    • Insertion Sort
    • Merge Sort
    • Quick Sort
    • Heap Sort
    • Counting Sort
    • Radix Sort
  • Searching Algorithms (as static methods of Searching class)
    • Linear Search
    • Binary Search
    • Jump Search
    • Exponential Search
  • Algorithmic Paradigms
    • Dynamic Programming (Knapsack, Longest Common Subsequence)
    • Backtracking (N-Queens, Sudoku Solver)
    • String Searching (KMP Algorithm)

Running Tests

To run the unit tests, first ensure you have pytest installed. It is recommended to use a virtual environment:

# Create and activate a conda environment
conda create -n dsaedge-test-env python=3.9 pytest -y
conda activate dsaedge-test-env

# Install the package in editable mode
pip install -e .

# Run tests
pytest

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.2.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.2.0-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dsaedge-0.2.0.tar.gz
Algorithm Hash digest
SHA256 31310c7fb3c18f561fd007a5349b93d82c866f97a829019c9d95327c16f4ded8
MD5 fbdb6bf3f6ff024749affea0ed20054a
BLAKE2b-256 ae7450dcf49558384c13a506fa82c4b909725683a00259f5e8901e3e64cee56c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dsaedge-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 27.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.23

File hashes

Hashes for dsaedge-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c18021c0d2a365df9454944509bf206e6b72686635263b13cb43706f171b7708
MD5 425ef3ef039aa0bfb3bbb1a4dcbb6e9c
BLAKE2b-256 80bd8940aa6bd213fc456a17e9173105180882559fabc48cb7928c81cdefde67

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