Skip to content

Latest commit

 

History

History
55 lines (43 loc) · 2.01 KB

readme.md

File metadata and controls

55 lines (43 loc) · 2.01 KB

sortingAlgorithms

A collection of sorting algorithms written in Python. An educational tool used for demonstrations of said algorithms.

Current Algorithms

Quick Start

  • Clone Repository:
    git clone https://github.com/ArcherHume/sortingAlgorithms.git
    cd sortingAlgorithms
    
  • Install Dependencies:
    pip install -r requirements.txt
    
  • Run Script: Usage

Usage

USAGE:
    python main.py -t [algorithm]

    Flags:
        -t [algorithm] (Required): The algorithm you would like to run.
            Choose from: selection, selection_recursive, bubble, quick_sort, insertion, shell, comb.
        -l [length] (Optional): The length of the array to be sorted. Defaults to 5000.
        -r [repeats] (Optional): The number of times to repeat the algorithm. Defaults to 3.
        -d [delay] (Optional): The delay between each step of the algorithm, used to watch each individual step. Defaults to 0.
        -width [width] (Optional): The width of the screen. Defaults to 800.
        -height [height] (Optional): The height of the screen. Defaults to 600.
        -h (Optional): Prints this message.
        -debug (Optional): Enables debug mode.

    Example: python main.py -t selection -l 10000 -r 6

How to add a new algorithm

  • Open the modules/sorting_algorithms.py file.
  • Create a function with a lowercase, underscore-separated name. Add the positional arguments array then delay.
    • Example: def selection_sort(sorting_array, delay)
  • Any modifications/sorting done on the array will be reflected on screen.