Skip to content

neha-deshpande001/bubble_sort_visualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

Bubble Sort Visualizer

Overview

This program is a visual demonstration of bubble sort, a very basic O(n^2) sorting algorithm. The program first populates an array with randomly sized bars that span the width of the window. Then, it uses the bubble sort algorithm to sort them by height from shortest (left) to tallest (right), making one comparison or one switch per loop. The program stops after all the elements have been sorted.

The purpose of this project was to become more conversant in the Processing language and gain a deeper understanding of bubble sort by coding my own version of the typical sorting visualization from scratch.

Demonstration

             Small Dataset - 10 Elements
Short and sweet

             Medium Dataset - 20 Elements
Slow and steady wins the race?

             Large Dataset - 50 Elements
As fast as a cheetah

Installation

  1. Download Processing 3.

  2. Download and unzip sort_visualizer.pde.

  3. Run sort_visualizer.pde with Processing 3.

  4. On line 4, change "10" to the number of elements you want the program to sort. More elements implies that the sorting process will take more time.

  int numElements = 10;
  1. Click the triangle "play" button on the top left of the Processing window to run the program.

About

A visualization of the bubble sort algorithm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published