{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Algorithms" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from algorithm_visualizer import alvito\n", "from utils import random_array\n", "\n", "avo = alvito()\n", "avo.custom_save_name = True\n", "shape = (6,6)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Bubble Sort" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "100%|██████████| 35/35 [02:33<00:00, 1.03s/it]\n" ] } ], "source": [ "array = random_array(shape)\n", "avo.save_name = 'bubble_sort_6_6'\n", "avo.bubbleSort(array)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![](gifs/bubble_sort_6_6.gif)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Selection Sort" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "100%|██████████| 35/35 [02:35<00:00, 1.10it/s]\n" ] } ], "source": [ "array = random_array(shape)\n", "avo.save_name = 'selection_sort_6_6'\n", "avo.selectionSort(array,)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![](gifs/selection_sort_6_6.gif)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Insertion Sort" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "100%|██████████| 35/35 [01:18<00:00, 3.72s/it]\n" ] } ], "source": [ "array = random_array(shape)\n", "avo.save_name = 'insertion_sort_6_6'\n", "avo.insertionSort(array)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![](gifs/insertion_sort_6_6.gif)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.1" } }, "nbformat": 4, "nbformat_minor": 2 }