/artific

An algorithm visualization pip package for Python

Primary LanguagePythonMIT LicenseMIT


Logo

An algorithm visualization pip package for Python
Explore the docs »

Pypi status Travis CI status
Table of Contents
  1. Getting Started
  2. Algorithms
  3. Notebooks
  4. TODO
  5. Acknowledgments

Getting Started

Installation

Stable release

To install artific, run this command in your terminal

pip install artific

This is the preferred method to install artific, as it will always install the most recent stable release.

If you don't have pip installed, this Python installation guide can guide you through the process.

Algorithms

Sorting

Bubblesort

from artific import BubbleSort

arr = [90,6,2,55,67,2,0,12,92,5,76,2,9,3]
arr = BubbleSort(arr)

arr.visualize()
print(arr)

Output

[0, 2, 2, 2, 3, 5, 6, 9, 12, 55, 67, 76, 90, 92]

The code above will generate the following GIF

Insertionsort

from artific import InsertionSort

arr = [90,6,2,55,67,2,0,12,92,5,76,2,9,3]
arr = InsertionSort(arr)

arr.visualize()
print(arr)

Output

[0, 2, 2, 2, 3, 5, 6, 9, 12, 55, 67, 76, 90, 92]

The code above will generate the following GIF

Heapsort

from artific import HeapSort

arr = [90,6,2,55,67,2,0,12,92,5,76,2,9,3]
arr = HeapSort(arr)

arr.visualize()
print(arr)

Output

[0, 2, 2, 2, 3, 5, 6, 9, 12, 55, 67, 76, 90, 92]

The code above will generate the following GIF

Searching

Linear search

from artific import LinearSearch

arr = [90,6,2,55,67,2,0,12,92,5,76,2,9,3]
obj = LinearSearch(arr,1)

obj.visualize()
print(obj)

Output

3

The code above will generate the following GIF

Binary search

from artific import BinarySearch

arr = [0, 2, 2, 2, 3, 5, 6, 9, 12, 55, 67, 76, 90, 92]
obj = BinarySearch(arr,55)

obj.visualize()
print(obj)

Output

9

The code above will generate the following GIF

TODO

  • Searching
  • Graph Algorithms
  • Trees

Acknowledgments

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.