Skip to main content

Programming algorithm training package for programmers and students

Project description

#Algorithm Training for Python

This project is for programmers and students to practice the programming of algorithms. The test cases and example implementation are included and ready to use.

Installation

$ pip install algorithm-training

Usage

Test your own algorithm

Let's take sorting algorithm as an example. You can create your own algorithm in a function, then add a main block to test your function.

from algorithm_training import test
from algorithm_training.classic.sort import test_cases

def my_sort_function(arr):
    # my implementation
    return arr

if __name__ == '__main__':
    test(my_sort_function, test_cases)

Benchmark your algorithm against reference implementations

from algorithm_training import benchmark
from algorithm_training.classic.sort import algorithms, test_cases

def my_sort_function(arr):
    # my implementation
    return arr

if __name__ == '__main__':
    benchmark(my_sort_function, algorithms, test_cases)

Implemented Algorithms

Sort

Following import statement should be included in your code.

from algorithm_prep import test, benchmark
from algorithm_prep.classic.sort import test_cases, algorithms

Define your sorting function

def your_sort_algorithm(arr):
	"""
    :type arr: List[int]
    :rtype: List[int]
    """
	# your codes go here

To test the function

test(your_sort_algorithm, test_cases)

To benchmark your algorithm

benchmark(your_sort_algorithm, algorithms, test_cases)

Following reference algorithms are implemented for benchmark

  • Bubble Sort
  • Insertion Sort
  • Merge Sort
  • Quick Sort
  • Heap Sort
  • Radix Sort

String Search

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

algorithm-prep-0.0.2.tar.gz (41.3 kB view details)

Uploaded Source

Built Distribution

algorithm_prep-0.0.2-py3-none-any.whl (44.6 kB view details)

Uploaded Python 3

File details

Details for the file algorithm-prep-0.0.2.tar.gz.

File metadata

  • Download URL: algorithm-prep-0.0.2.tar.gz
  • Upload date:
  • Size: 41.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for algorithm-prep-0.0.2.tar.gz
Algorithm Hash digest
SHA256 18fabf2eaf39f559c8fedffd91794055de004a9177be12c05d0953043819dc9f
MD5 fa4f030316d4da6af5abaa8f905033d5
BLAKE2b-256 2f2edf5b4918330981ef1beb8186b15f27ecc881309dbf0d69da984871a9bc8e

See more details on using hashes here.

File details

Details for the file algorithm_prep-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: algorithm_prep-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 44.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for algorithm_prep-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 05cbe2385ae6fa20a39a9190cdc5d79abe01f9622d3097bba43f3ac96402a46d
MD5 71b631d941fa9123950b58c4c4deca05
BLAKE2b-256 7e78c2492b9526e9f6c5fba8439d7f5d0f767a23624b7c679c481090f4c76d93

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