The Wayback Machine - https://web.archive.org/web/20190322172324/https://github.com/OmkarPathak/pygorithm
Skip to content
Please note that GitHub no longer supports Internet Explorer.

We recommend upgrading to the latest Microsoft Edge, Google Chrome, or Firefox.

Learn more
A Python module for learning all major algorithms
Branch: master
Clone or download
Latest commit 20546c9 Nov 15, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
imgs
pygorithm Update heap_sort.py Oct 1, 2018
tests
.gitignore Updated unittests to run with unittest command Aug 6, 2017
CONTIRBUTORS.md
LICENSE Initial commit Jul 31, 2017
MANIFEST.in
README.rst Update README.rst Nov 15, 2018
TODO.md Updated TODOs Sep 1, 2017
setup.cfg Added updated setup.py, MANIFEST file and setup.cfg Aug 16, 2017
setup.py

README.rst

Pygorithm

Packagist Downloads Documentation Status Python 3.6 Say Thanks! Contributors
A Python module to learn all the major algorithms on the go!
Purely for educational purposes

Features

  • Super easy to use
  • A very easy to understand Documentation
  • Get the code right in your editor
  • Get time complexities on the go

Installation

  • Just fire the following command in your terminal:
pip3 install pygorithm
  • It's that easy. If you are using Python 2.7 use pip instead. Depending on your
    permissions, you might need to use pip install --user pygorithm to install.
  • Or you can download the source code from here, and then just install the package using
python setup.py install

Quick Start Guide

  • To sort your list
>>> from pygorithm.sorting import bubble_sort
>>> my_list = [12, 4, 3, 5, 13, 1, 17, 19, 15]
>>> sorted_list = bubble_sort.sort(my_list)
>>> print(sorted_list)
>>> [1, 3, 4, 5, 12, 13, 15, 17, 19]
  • To get the code for function used
>>> from pygorithm.sorting import bubble_sort
>>> code = bubble_sort.get_code()
>>> print(code)
  • To get the time complexity of an algorithm
>>> from pygorithm.sorting import bubble_sort
>>> time_complexity = bubble_sort.time_complexities()
>>> print(time_complexity)
  • To see all the available functions in a module, you can just type help() with the module name as argument. For example,
>>> from pygorithm import sorting
>>> help(sorting)
    Help on package pygorithm.sorting in pygorithm:

    NAME
        pygorithm.sorting - Collection of sorting methods

    PACKAGE CONTENTS
        bubble_sort
        bucket_sort
        counting_sort
        heap_sort
        insertion_sort
        merge_sort
        modules
        quick_sort
        selection_sort
        shell_sort

Tests

  • Just type in the following command to run the tests
python3 -m unittest
  • This will run all the tests defined in the files of the tests/ directory

Donation

If you have found my softwares to be of any use to you, do consider helping me pay my internet bills. This would encourage me to create many such softwares :)

You can’t perform that action at this time.