Skip to content

This program offers real-time visualizations of various sorting algorithms

Notifications You must be signed in to change notification settings

nat-laz/sorting-algorithm-visualization

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Visualization of different sorting algorithms

Insertion sort gif

Welcome to our sorting algorithm visualization project! This program offers real-time visualizations of various sorting algorithms, allowing you to understand and compare them in action. It currently supports the following algorithms:

  • Bubble Sort
  • Selection Sort
  • Quick Sort
  • Insertion Sort
  • Heap Sort

Table of Contents

Algorithms

Bubble Sort

Bubble Sort is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order. This process continues until the list is fully sorted, with larger elements " bubbling" to the top. For e.g: in ascending order, the largest elements gradually move to the last position with each pass.

Show Bubble Sort Visualization

Bubble Sort visualization

Selection Sort

Selection Sort is a simple comparison-based algorithm that sorts a list by dividing it into a sorted and an unsorted part. It repeatedly finds the smallest (or largest) element from the unsorted part and swaps it with the first unsorted element, gradually growing the sorted portion until the entire list is sorted.

Show Selection Sort Visualization

Selection Sort visualization

Quick Sort

QuickSort is a highly efficient sorting algorithm that uses a divide-and-conquer approach. It selects a "pivot" element and partitions the array into two sub-arrays: one with elements less than the pivot and one with elements greater than the pivot. This process is recursively applied to each sub-array until the entire list is sorted.

Show Quick Sort Visualization

Quick Sort visualization

Insertion Sort

Insertion Sort is a simple sorting algorithm that builds a sorted list one element at a time. It picks the next element from the unsorted list, finds its correct position in the sorted list, and inserts it there. This process repeats until all elements are sorted.

Show Insertion Sort Visualization

Insertion Sort visualization

Heap Sort

HeapSort is a sorting algorithm that uses a binary heap data structure to sort elements. It first builds a max heap from the input data, then repeatedly removes the largest element from the heap and places it at the end of the list, sorting the list in ascending order.

Show Heap Sort Visualization

Insertion Heap visualization

How to Build & Run

You need at least java 11

How to Build executable file?

  1. Clone this repo
  2. Open terminal in a root folder and run this command
mvn clean package

This command will create /taget folder and executable sav-version-jar-with-dependencies.jar inside.

How to Run?

  1. Download .jar file from latest release.

  2. Open terminal in a folder where the .jar file is located. Run this command to start the program:

java -jar sav-1.2-jar-with-dependencies.jar

About

This program offers real-time visualizations of various sorting algorithms

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%