Giter Site home page Giter Site logo

sorting-visualizer's Introduction

Sorting Algorithms Visualizer

Interactive React JS web application that visualizes Bubble Sort, Merge Sort, Quick Sort, and Heap Sort algorithms in real-time. This includes step-by-step execution and animation of the sorting process.

Live Demo: https://nurasad.github.io/sorting-visualizer

Purpose

The purpose of the Sorting Algorithms Visualizer project is to create an interactive and educational tool for exploring various sorting algorithms in action. By providing real-time visualizations of sorting processes, the project aims to enhance understanding and appreciation of fundamental algorithms used in computer science. It serves as a platform to experiment with different algorithms, observe their behavior, and gain insights into their performance characteristics.

Spotlight

Key features of this web application include:

  1. "Generate New Array" Button: Upon clicking this button, a new row of vertical bars with varying heights is generated. These bars represent the elements of an array, which will then be sorted using the chosen algorithm.

  2. Animation Control: During the visualization process, all other functionality is disabled to focus on the sorting animation. Once the animation stops, sorting buttons remain inactive until a new array is generated, ensuring a smooth and uninterrupted user experience.

  3. Speed Adjustment: Users can adjust the speed of the sorting process using a speed slider. This allows for customization of the animation speed according to individual preferences, facilitating a tailored and interactive learning experience.

Lessons Learned

Initially, the idea for this project came from viewing videos on YouTube on how different sorting algorithms work. I thought that such animations could be created with JavaScript. Thankfully, YouTube videos gave me an idea that such animation can be done using an array of vertical bars with different heights.

After the preparation of such an array, the real hard work started. Understanding the principles of sorting algorithms turned out to be insufficient to implement them right away. Also, React DOM tends to collect all changes before updating, which is great for efficiency but bad for the main purpose of this project. The solution that I came up with was using the setTimeOut functionality to give React time to update DOM and show changes in the array. I rewrote some sorting algorithms to collect all changes that were made at each step of sorting and then animated them.

During working on this project I learned how to correctly update state of different components depending on the stage of process.

One of the big drawbacks of this web application is that it is not designed to be responsive because the vertical bars used to visually represent the sorting process need to be of sufficient height and quantity, which may not scale effectively on smaller screens.

sorting-visualizer's People

Contributors

nurasad avatar

Stargazers

 avatar

Watchers

 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.