smv1999 / py_dsa

The py_dsa package contains all the data structures and algorithms implementations

Home Page:https://pypi.org/project/py-dsa/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

py-dsa

GitHub followers GitHub forks GitHub Repo stars Lines of code GitHub PyPI

Introduction

The py-dsa module contains all the data structures and algorithms implementations.

Installation

You can install the module using pip as shown below.

pip install py-dsa

Usage

Consider the following examples :

from py_dsa.data_structures import *

test_linkedlist = LinkedList()
test_linkedlist.add_first(10)
test_linkedlist.add_first(20)
test_linkedlist.add_first(30)
test_linkedlist.remove_last()
test_linkedlist.reverse_list()
test_linkedlist.print_list()
"""
Output :
20
30
"""
from py_dsa.data_structures import *

test_tree = Tree()
test_tree.add(10)
test_tree.add(5)
test_tree.add(30)
print(test_tree.height())
test_tree.invert_tree()
test_tree.print_tree(traversal='postorder')
"""
Output:
2
30
5
10
"""
from py_dsa.algorithms import *

a = [1, 2, 3, 4.5]
s = Searching()
print(s.linear_search(a, 3))
"""
Output : 
2
"""

Testing

To install py-dsa, along with the tools you need to develop and run tests. Run the following command :

$ pip install -e .[dev]

For running the tests, type the following command :

py.test

Bugs/Requests

Please use the GitHub issue tracker to submit bugs or request features.

License

Copyright Vaidhyanathan S M, 2021

Distributed under the terms of the MIT license, py-dsa is free and open source software.

About

The py_dsa package contains all the data structures and algorithms implementations

https://pypi.org/project/py-dsa/

License:MIT License


Languages

Language:Python 100.0%