Skip to main content

Python Package for Data structure and algorithms implementation with its proper explanation

Project description

pyPantry: Your One-Stop Solution for DSA, Design Patterns and etc. in Python

pyPantry is a comprehensive Python library offering robust implementations of numerous data structures and algorithms. It serves as a reliable tool for educators, students, developers, and anyone keen on mastering or utilizing these foundational computer science concepts.

📋 Table of Contents

🌟 Features

Data Structures

  • Graph: Traverse complex networks.

    • PyGraph.py
    • PyLinkedGraph.py
  • Heap: Efficient data management.

    • PyMaxHeap.py
    • PyMinHeap.py
  • LinkedList: Flexible data storage.

    • PyCircularLinkedList.py
    • PyDoublyCircularLinkedList.py
    • PyDoublyLinkedList.py
    • PyHeaderLinkedList.py
    • PyLinkedList.py
    • PySkipLinkedList.py
  • Queue: FIFO data handling.

    • PyCircularQueue.py
    • PyDeque.py
    • PyPriorityQueue.py
    • PyQueue.py
  • Stack: LIFO data access.

    • PyStack.py
    • pyLinkedStack.py
  • Tree: Hierarchical data modeling.

    • PyAVLTree.py
    • PyBTree.py
    • PyBinarySearchTree.py
    • PyBinaryTree.py
    • PyGenericTree.py
  • Trie: Rapid text retrieval.

    • PyTrie.py

Algorithms

Searching

  • Binary Search: PyBinarySearch.py
  • Jump Search: PyJumpSearch.py
  • Linear Search: PyLinearSearch.py
  • Fibonacci Search: PyFibonacciSearch.py
  • Exponential Search: PyExponentialSearch.py
  • Ternary Search: PyTernarySearch.py
  • Meta Binary Search: PyMetaBinarySearch.py
  • Sentinel Linear Search: PySentinelLinearSearch.py
  • Interpolation Search: PyInterpolationSearch.py

Sorting

  • BogoSort: PyBogoSort.py
  • Odd-Even Sort: PyOddEvenSort.py
  • Sleep Sort: PySleepSort.py
  • Cocktail Sort: PyCocktailSort.py
  • Radix Sort: PyRadixSort.py
  • Bubble Sort: PyBubbleSort.py
  • Selection Sort: PySelectionSort.py
  • Bingo Sort: PyBingoSort.py
  • QuickSort: PyQuickSort.py
  • Counting Sort: PyCountingSort.py
  • Bucket Sort: PyBucketSort.py
  • Gnome Sort: PyGnomeSort.py
  • HeapSort: PyHeapSort.py
  • Bitonic Sort: PyBitonicSort.py
  • Strand Sort: PyStrandSort.py
  • Shell Sort: PyShellSort.py
  • TimSort: PyTimSort.py
  • Pancake Sort: PyPancakeSort.py

Design Patterns

Architectural Patterns

  • Event-Driven Architecture: PyEventDrivenArchitecturePattern.py
  • Microservices: PyMicroservicesPattern.py
  • Model-View-Controller (MVC): PyModelViewControllerPattern.py
  • Model-View-ViewModel (MVVM): PyModelViewViewModelPattern.py
  • Service-Oriented Architecture (SOA): PyServiceOrientedArchitecturePattern.py

Behavioral Patterns

  • Chain of Responsibility: PyChainOfResponsibilityPattern.py
  • Command: PyCommandPattern.py
  • Interpreter: PyInterpreterPattern.py
  • Iterator: PyIteratorPattern.py
  • Mediator: PyMediatorPattern.py
  • Memento: PyMementoPattern.py
  • Null Object: PyNullObjectPattern.py
  • Observer: PyObserverPattern.py
  • Specification: PySpecificationPattern.py
  • State: PyStatePattern.py
  • Strategy: PyStrategyPattern.py
  • Template: PyTemplatePattern.py
  • Visitor: PyVisitorPattern.py

Concurrency Patterns

  • Active Object: PyActiveObjectPattern.py
  • Half-Sync/Half-Async: PyHalfSyncOrHalfAsyncPattern.py
  • Leader-Follower: PyLeaderOrFollowerPattern.py
  • Reactor: PyReactorPattern.py
  • Thread Pool: PyThreadPoolPattern.py

Creational Patterns

  • Abstract Factory: PyAbstractFactoryPattern.py
  • Builder: PyBuilderPattern.py
  • Factory Method: PyFactoryPattern.py
  • Object Pool: PyObjectPoolPattern.py
  • Prototype: PyPrototypePattern.py
  • Singleton: PySingletonPattern.py

Structural Patterns

  • Adapter: PyAdapterPattern.py
  • Bridge: PyBridgePattern.py
  • Composite: PyCompositePattern.py
  • Decorator: PyDecoratorPattern.py
  • Facade: PyFacadePattern.py
  • Flyweight: PyFlyweightPattern.py
  • Private Class Data: PyPrivateClassDataPattern.py
  • Proxy: PyProxyPattern.py

🔧 Installation

pip install python-Pantry 

🚀 Usage

Data Structures

from pyPantry.DS.Stack.PyStack import PyStack

# Create a new stack
stack = PyStack()

# Push elements onto the stack
stack.push(1)
stack.push(2)
stack.push(3)

# Pop an element from the stack
print(stack.pop())  # Output: 3

Algorithms

from pyPantry.Algo.Sorting.PyBubbleSort import PyBubbleSort

# Sample list to be sorted
sample_list = [64, 34, 25, 12, 22, 11, 90]

# Apply bubble sort
sorted_list = PyBubbleSort(arr=sample_list).sort()
print(sorted_list)  # Output: [11, 12, 22, 25, 34, 64, 90]

Design Patterns

Strategy Pattern

from pyPantry.DesignPatterns.Behavioral.Strategy.PyStrategyPattern import PyStrategyPattern

class CreditCardPayment(PyStrategyPattern.PaymentStrategy):
    def pay(self, amount):
        return f"Paid {amount} using Credit Card"

payment_method = CreditCardPayment()
print(payment_method.pay(100))  # Output: Paid 100 using Credit Card

🧪 Testing

All implementations come with corresponding test files located in the tests directory, ensuring reliability and correctness.

To run tests, use:

python -m unittest discover tests

🤝 Contributing

We welcome and value contributions from the open-source community. Your input, whether it's a bug fix, feature addition, or documentation improvement, helps enhance pyPantry.

  1. Fork the repository.
  2. Create a new branch.
  3. Make your changes.
  4. Submit a pull request.

👏 Credits

Crafted with ❤️ by Sattyam Jain.

📜 License

Licensed under the MIT License.

📞 Contact

For feedback or queries, contact us. We're always eager to connect!

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

python_pantry-3.0.2.tar.gz (54.2 kB view details)

Uploaded Source

Built Distribution

python_Pantry-3.0.2-py3-none-any.whl (126.0 kB view details)

Uploaded Python 3

File details

Details for the file python_pantry-3.0.2.tar.gz.

File metadata

  • Download URL: python_pantry-3.0.2.tar.gz
  • Upload date:
  • Size: 54.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for python_pantry-3.0.2.tar.gz
Algorithm Hash digest
SHA256 c9f8eb4637f73d9d52800169c1bdbaeafbcad4fec70f6b5bad8e93db447943eb
MD5 50e14aca3d12834e69d7e8eaada1ea0a
BLAKE2b-256 04b0c080aba8e185a9d8ff77b2f0df8013056ec1da74436e20ce55964bbd1430

See more details on using hashes here.

File details

Details for the file python_Pantry-3.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for python_Pantry-3.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d45b4e522fa7b4965dbb992b45a5dad5159dfd3151a85b440139b8d6c0bc8dba
MD5 1d70ba984a57d35b8582b4794c03aaf2
BLAKE2b-256 d5c23cc1443e175359e7e045ceff44db07ab13bcfa1d8f227f13a0c61fb7582d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page