Code Monkey home page Code Monkey logo

sorting_visualization's Introduction

Sorting Visualization and Audibilization

Latest Update2 (05/04/2019)

  • Great News: Now we can get the Voice of Sorting Algorithm simultaneously, and this is so funny that we should all have a try!!!

Latest Update

  • Add three more sorting algorithms: CombSort, RadixSort, MonkeySort
  • Now you can record the whole sorting procedure to *avi videos.
  • Adding -r in command line can get you Re-sampled data.
  • Adding -s in command line can get you Sparse data.

Introduction

This repository is a demo of visualizing 12 types of Sorting Algorithms. It aims to make Sorting Algorithms easier for programmers to understand. Also, you can see the difference of Time Complexity between different sorting algorithms.

Sorting Algorithm AverageTime Complexity Bad Time Complexity Stability
Bubble Sort O(N^2) O(N^2) YES
Insertion Sort O(N^2) O(N^2) YES
Shell Sort O(N^5/4) O(N^2) NO
Selection Sort O(N^2) O(n^2) NO
Heap Sort O(NlogN) O(NlogN) NO
Merge Sort O(NlogN) O(NlogN) YES
Quick Sort O(NlogN) O(N^2) NO
Bucket Sort O(N) O(N) YES
Cycle Sort O(N) O(N^2) NO
Comb Sort O(N^2) O(N^2) NO
Radix Sort O(N) O(N) YES
Monkey Sort O(N!) O(N!) YES

Demos

Dependencies

  • python3.x
  • cv2
  • numpy
  • pygame

Quick Start

  1. Check all dependencies installed

    This command can help you install all the dependent packages

    pip install -r requirements.txt

  2. Clone this repository

    git clone [email protected]:ZQPei/Sort_Visualization.git

  3. Start

    python main.py -l 512 -t BubbleSort

    • -l --length: Array Length
    • -t --sort-type: Sorting Type. Default type is BubbleSort
      • BubbleSort
      • InsertionSort
      • ShellSort
      • SelectionSort
      • HeapSort
      • MergeSort
      • QuickSort
      • BucketSort
      • CycleSort
      • CombSort
      • RadixSort(LSD)
      • MonkeySort
    • -i --interval: Time Interval of next frame
    • -r --resample: Get Resampled Array
    • -s --sparse: Sparse Array
    • -n --no-record: Don't record to *.avi video!
    • --silent: No voice output
    • --sound-interval: Time of sound

May you have fun!

sorting_visualization's People

Contributors

zqpei avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.