vicrazumov / sort-viz

Visualise your sorting (or any other array transforming) algorithm in javascript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sorting visualizer

Takes your javascript code, applies it to a random array of numbers and visualises the changes step by step.

Quick sort

What's interesting?

  1. it uses JS Proxies to register each transformation of an array, that will become a frame in animation
  2. it moves the execution of a customer script to a separate thread in order to keep the main thread unlocked (e.g., if you need to sort 10M items) Pay attention: running 3rd party code this way is insecure.
  3. it creates a web worker with a custom code on the fly by using a Blob API.

Usage

  1. clone the repo and run a static http-server from this folder
  2. by default, it uses a quick sort algorithm. You can update this in index.html.
  3. by default, it uses an array of 1000 random numbers. Adjust that in index.js

About

Visualise your sorting (or any other array transforming) algorithm in javascript


Languages

Language:JavaScript 63.6%Language:HTML 28.8%Language:CSS 7.6%