Git Product home page Git Product logo

dsalgo's Introduction

MIT licence Forks Forks issues

image not found

dsalgo is a python library which implements and cover different data structures and algorithms in python to reduce the dependency of coding these datastructures for usage.

AIM:

To cover different available data structures and algorithms for generic cases.


ALGORITHMS AVAILABLE

  • Linked List algorithms
    • Insert
    • Remove
    • Pop
    • Append
    • Prepend
    • Pop
    • Reverse
    • Size
    • IsCircular
    • Swap Nodes
    • Sort Append
    • Skip i Delete j
  • sorting algorithms
    • Bubble Sort
    • Merge Sort
    • Bubble Recursion Sort
    • Selection Sort
    • Quick Sort
  • Searching algorithms
    • Binary Search
    • Linear Search
    • Jump Search
    • Interpolation Search
    • Fibonacci Search

CONTENTS:


SETTING UP

FOR LOCAL:

Currently dsalgo doesn't support local mode.

FOR DEVELOPMENT:

Setting up for development is easy. use commands below.

  • First, clone the repository
  • Go to tha parent directory outside the repository and install using pip by
pip install -e dsalgo

or,

pip install git+https://github.com/codesankalp/dsalgo.git

CONTRIBUTION

Anyone can contribute to dsalgo package following these Contribution Guidelines


CODE OF CONDUCT

For maintaining a positive environment while contibuting to dsalgo package, everyone is required to follow these Code of Conduct


dsalgo's People

Contributors

17sushmita avatar aryamanz29 avatar codesankalp avatar devkapilbansal avatar devta108 avatar ravi5175 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

dsalgo's Issues

Implement searching algorithms

Add these algorithms

  • 1. Linear Search
  • 2. Binary Search
  • 3. Jump Search
  • 4. Interpolation Search
  • 5. Exponential Search
  • 6. Fibonacci Search
  • 7. Recursive program to linearly search an element in a given array
  • 8. Recursive function to do a substring search

Also write test cases for the same. Tests and code can be divided in two commits though.

Improve contributing.md

Description

After reviewing some pull requests, I realised that we don't have strict guidelines in contributing files. Here are some changes I would suggest:

We can add a commit template later for this

  • Before working on an issue, you should get it assigned.

  • If an issue is assigned to you, be sure to post updates. Otherwise, the assignee would be removed after 3 days of inactivity

  • You should make a branch other than the default branch for the pull request.

[docs] Update README

Now we are ready to release a starting version of this package. So to make it understandable to other users it is required to have a good readme.

  • While writing readme it is required to think like you have never used this code and you are a complete beginner.
  • readme extension must be .rst because it will also be available on PyPI.

The basic idea of this repository is to create reusable functions for ds and algo so that users don't need to rewrite the same piece of code again and again.

List Available Algorithms of the Module

As the Module is constantly upgrading, a list of implemented algorithms needs to be present at the cover ReadMe of the repository. It will help Users to find and select algorithms they need and will help contributors to decide to write a new algorithm for the module.

Implement Binary tree

  • 1. Create root
  • 2. Insertion into a tree
  • 3. Transversing a tree
  • 4. Search for a value in a B-tree

Doubly linked list items count

Currently there is a doubly_linked_list.py file in dsalgo (not merged yet) folder but there is no way to count the number of items of a given doubly linked list for example, if items = doubly_linked_list()

then:

  • code for which items.count will show up the number of item
  • make a pull request for queue branch not for master branch.
  • update the queue branch with the master.

P.S : Refer this commit for doubly_linked_list.py file.
or the issue #56

PR Protocol

required submission protocols for pull request.
type: google doc, word , ppt
must include: format for pull request, test,quality assurance and other neccessary checks

Insert an item in front of a doubly linked list

Currently there is a doubly_linked_list.py file in dsalgo (not merged yet) folder but there is no way to insert an item in front of a given doubly linked list for example, if function name is insert_start() (this is preferred name)

then:

  • code for which items.insert_start([this contains required object]) will show up the new object added in front of the doubly linked list created previously in continuation with issue #67
  • make a pull request for queue branch not for master branch.
  • update the queue branch with the master.

P.S : Refer this commit for doubly_linked_list.py file.
or the issue #56 in continuation with issue #67

Implement graph alogrithms

May be adding this would be beneficial

  • 1. Depth First Traversal (DFS)
  • 2. Breadth First Traversal (BFS)

print_backward function in doubly linked list

Is your request related to a problem? Please describe.
When we try to print list in backwards way, for that a function is required.

Describe the solution you'd like
To create a doubly linked list and print nodes from current position to first node.

Describe alternatives you've considered
Using a print_backward() function

Additional context
No additional context

Implement tree algo in tree.py

For example:
is_balanced()
is_subtree()
is_symmetric()
longest_consecutive()
lowest_common_ancestor()
max_height()
max_path_sum()
min_height()

doubly linked list

create a doubly linked list, append some items and iterate through the list (print forward)

Implement "shell sort" algorithm

Related to #4

Write test cases(using python unittest framework) for this issue in existing file dsalgo/tests/sort _tests.py (This mandatory for the issue to be merged)

all string algorithms implementation

to solve this issue you must include some of the programs to make string algorithms easy usable
like: -
fizz buzz
delete_reoccurring_characters
strip_url_params
validate_coordinates
domain_extractor
merge_string_checker
add_binary
breaking_bad
decode_string
encode_decode
group_anagrams
int_to_roman
is_palindrome
license_number
make_sentence
multiply_strings
one_edit_distance
rabin_karp
reverse_string
reverse_vowel
reverse_words
roman_to_int
word_squares
and much more
note:- not needed to implement every above-mentioned idea
you can create your own if it's good.

heap implementation

merge_sorted_k_lists
skyline
sliding_window_max binary_heap
or any other method related to heap.

String algos requirement

I was going through issue #23 and here one required algo is string subsequence matching, while looking through the code structure, it seems it is not a great idea to implement something related to strings in the same section. I suggest creating a separate code segment for string manipulation algorithms.

Required Node addressing in to_list() function in linked list

NAME:
address visualization support for individual nodes


ABOUT:
while exporting nodes of linked-list in a list format (to_list()),addressing address of each node for debugging.


SOLUTION
append address to the node values while calling to_list() function.


ALTERNATIVE
address can be printed while itterating of node manually but it will be a time consuming task, hence not preferred

Implement Heap Data Structure

Is your request related to a problem? Please describe.

New Feature: Implementing Heap data structure to the Library

Describe the solution you'd like

Use class and define all operations as methods

Additional context

  • Add a parameter min or max to identify min heap or max heap
  • Define all possible operations on Heap

Implement Graphs

Some examples :

  • 1. To generate the path from one node to the other node

  • 2. Program to generate all the possible paths from one node to the other.

  • 3. Program to generate the shortest path.

- NOTE: Write test cases(using python unittest framework) for this issue and create a separate file named as graphs_test.py in dsalgo/test(This mandatory for the issue to be merged)

Implement Basic Math Algorithms

Currently, python provides basic math operations but they are not that flexible. Like you can calculate H.C.F. of two numbers but what if we want to calculate H.C.F. of a list.
Also, we can implement other algorithms like for prime, next prime, last prime etc.

Add tests for queue.

Currently there is a pr for queue implementation but there are no test cases so you have to add the test for this in the queue branch.

what to do:

  • Write tests for pyqueue in tests/
  • make a pull request for queue branch not for master branch.
  • update the queue branch with the master.

Update list of available algorithms in Readme.md

Some PRs add algorithms to the repo but the Readme file is not updated sometimes, this may cause misunderstandings on what algorithms still need to be implemented. Hence the list of algorithms in readme must be revised after every successful merged PR.

Add function "merge()" in existing linked_list.py to perform merging of two given linked list.

Merge() two sorted linked lists and return it as a new list. The new list should
be made by splicing together the nodes of the first two lists.
For example:
Input: 1->2->4, 1->3->4
Output: 1->1->2->3->4->4

Also, create a separate test file linked_list_test.py in dsalgo/tests for this issue using python unittest (testing framework) Which contain tests for existing linked_list.py included merge().

Things need to be done for this issue:

  • Add a merge() in existing linked_list.py

  • Write tests using Unittest framework for complete file i.e linked_list.py

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.