ToolBunny LogoToolBunny
Back to Homepage
Algorithm Visualizer

Watch sorting algorithms in action.

About This Tool

The Algorithm Visualizer is an interactive educational tool designed to help developers, computer science students, and enthusiasts understand how different sorting algorithms work. By representing an array of numbers as bars of varying heights, this tool animates the entire sorting process, showing the step-by-step comparisons and swaps that each algorithm performs. It's an excellent way to see the efficiency, logic, and complexity of various sorting methods in action, making abstract concepts tangible and easier to grasp.

Available Algorithms:

Bubble Sort
The simplest sorting algorithm that repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order. Ideal for understanding basic sorting concepts.
Selection Sort
This algorithm divides the input list into a sorted and an unsorted region. It repeatedly selects the smallest (or largest) element from the unsorted region and moves it to the end of the sorted region.
Insertion Sort
A simple sorting algorithm that builds the final sorted array one item at a time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort.
Merge Sort
A highly efficient, stable, comparison-based sorting algorithm. It follows the divide-and-conquer paradigm by recursively dividing the list into sub-lists until each sub-list has only one element, then merging them in a sorted manner.
Quick Sort
An efficient, in-place, divide-and-conquer sorting algorithm. It works by selecting a 'pivot' element and partitioning the other elements into two sub-arrays, according to whether they are less than or greater than the pivot.
How to Use
  1. Select a sorting algorithm from the dropdown menu (e.g., "Bubble Sort").
  2. Use the "Array Size" slider to determine the number of items in the array to sort (from 10 to 100).
  3. Click "Generate New Array" to create a new random set of numbers to visualize.
  4. Use the "Speed" slider to control the animation speed for better observation.
  5. Click the "Sort" button to start the visualization. The bars will change color to indicate which elements are being compared, swapped, or have been sorted.
  6. You can pause, resume, or reset the visualization at any time using the control buttons.