Giter Site home page Giter Site logo

fql110422 / sorting-visualizer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zamhown/sorting-visualizer

0.0 0.0 0.0 11.81 MB

๐Ÿ“Š Some python scripts which can visualize several famous sorting algorithms and generate the animations via Matplotlib.

Home Page: https://zamhown.github.io/sorting-visualizer

License: MIT License

Python 100.00%

sorting-visualizer's Introduction

Sorting Visualizer

There are some python scripts which can visualize several famous sorting algorithms and generate the animations via Matplotlib.

Click the picture below to play the sample video.
click to play video
(You can also experience the webpage edition.)

Environment Configuring

  • Install Python 3 or Anaconda which includes it.
  • Install Matplotlib via pip. However, if you have installed Anaconda before, you needn't install Matplotlib any more.
  • If you need export the animations of sorting algorithms as MP4 files, you should download an offical release of FFMpeg (there is the link). Taking Windows for example, after downloading, extract it to anywhere, and add [your_path]/ffmpeg/bin to the environment variable PATH to ensure you can run the command ffmpeg directly in CMD.

Usage

Under the root directory of the project, run the commands like the following format to call all functions:

python output.py arg1 [arg2 [arg3]]  

Details of the three arguments above:

  • There are three posible options as "arg1":
    • play : Play an animation of a specific sorting algorithm or all algorithms in a new window, as a "figure" to Matplotlib.
    • save-html : Save the animation as a HTML page with a sequence of images.
    • save-mp4 : Save the animation as a MP4 video.
  • There are nine posible options as "arg2":
    • all (default) : Show the visualization of all sorting algorithms in the animation.
    • bubble-sort : Only show the visualization of bubble sorting algorithm in the animation. The following arguments have similar functions.
    • comb-sort
    • heap-sort
    • insertion-sort
    • merge-sort
    • quick-sort
    • selection-sort
    • shell-sort
  • There are four posible options as "arg3":
    • almost-sorted : Sort an almost-sorted sequence.
    • few-unique : Sort a few-unique sequence.
    • random (default) : Sort a random sequence.
    • reversed : Sort a descending sequence.

For example, run python output.py play heap-sort reversed to create a new window to play the animation of sorting, which use heap sorting algorithms and sort a descending sequence.

There's nothing else need to be introduced. Have fun!

sorting-visualizer's People

Contributors

zamhown 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.