Skip to content

Java implementation of commonly used sort functions

Notifications You must be signed in to change notification settings

mvakili/all-sorts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Java implementation of commonly used sort functions

This is the visual implementation of sorting algorithms. this code covers the following algorithms:

The implementation generates random unsorted double array based on user input and generates output both for CLI 🖥️ and GUI 📊 using java StdDraw library.

How it works

First of all, you should compile allSorts.java file using this command:

> javac allSorts.java

And to run the app, just run the command below. it will give some help for usage:

> java allSorts

Help:
java allSort [Algorithm Name] [Count] {delay}

Algorithm Names:
bubble:  Bubble Sort
selection: Selection Sort
insertion: Insertion Sort
quick: Quick Sort
merge: Merge Sort
shell: Shell Sort

Delay:
time for each compare to show graphics in Milisecond

Demos

Bubble Sort

> java bubble 20 100

Bubble Sort

Selection Sort

> java selection 20 100

Selection Sort

Insertion Sort

> java insertion 20 100

Insertion Sort

Quick Sort

> java quick 20 100

Quick Sort

Merge Sort

> java merge 20 100

Merge Sort

Shell Sort

> java shell 20 100

Shell Sort