Giter Club home page Giter Club logo

algorithms's Introduction

Algorithms

https://travis-ci.org/nryoung/algorithms.svg?branch=master http://codecov.io/github/nryoung/algorithms/coverage.svg?branch=master

This is an attempt to build a cohesive module of algorithms in Python.

The purpose of this repo is to be a learning tool for myself and others.

I used psuedo code from various sources and I have listed them as references in the source code of each algorithm.

Algorithms implemented so far:

Data Structures:

  • Queue
  • Stack
  • Disjoint Set
  • Single Linked List
  • Undirected Graph
  • Digraph

Sorting:

  • Bogo Sort
  • Bubble Sort
  • Cocktail Sort
  • Comb Sort
  • Heap Sort
  • Insertion Sort
  • Merge Sort
  • Quick Sort
  • In Place Quick Sort
  • Selection Sort
  • Shell Sort
  • Gnome Sort
  • Strand Sort

Searching:

  • Binary Search
  • Boyer-Moore-Horspool
  • Knuth-Morris-Pratt
  • Rabin-Karp
  • Depth First Search (Recursive)

Shuffling:

  • Knuth/Fisher-Yates Shuffle

Math:

  • Extended GCD
  • Standard Normal Probability Density Function
  • Cumulative Density Function (Approximation; 16 digit precision for 300 iter.)
  • Sieve of Eratosthenes

Dynamic Programming:

  • Longest Common Subsequence

Random:

  • Mersenne Twister

Installation:

If you want to use the algorithms directly, simply

$ pip install algorithms

If you want to examine the algorithms source, then you should clone this repo.

Usage:

Once installed you can simply do the following in your program:

from algorithms.sorting import bubble_sort

my_list = bubble_sort.sort(my_list)

All prequisites for the algorithms are listed in the source code for each algorithm.

Tests:

Pytest is used as the main test runner and all Unit Tests can be run with:

$ ./run_tests.py

Contributing:

If there is an algorithm or data structure that you do not see, but would like to add please feel free to do a pull request. I only ask two things:

  1. For each algorithm and data structure you implement please have corresponding unit tests to prove correctness.
  2. Please make sure that your module follows similar style guidelines that are laid out in the other modules.

I want to personally thank everybody that has contributed so far and your names will be added to AUTHORS.rst.

TODO:

See TODO.rst.

algorithms's People

Contributors

nryoung avatar jabagawee avatar dveselov avatar truongleswe avatar conanchou avatar cristobalmackenzie avatar jxtcman avatar kngspook avatar sawhney avatar utsavgupta avatar kabrapratik28 avatar lcheung90 avatar kishinmanglani avatar ppinette avatar dotslash avatar derv82 avatar rasbt avatar amaurymedeiros avatar gazolik avatar josephlane avatar kartiknagpal avatar cmltawt0 avatar noahtheduke avatar ryancoleman avatar skirkpatrick avatar fengsp avatar liam-m avatar nyqvist avatar

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.