A code collection of popular sort algorithms coded using java
This repository contains the java source codes that were written during my practice of implementing various sort algorithms from scratch using Java. This repo might be helpful for anyone who needs a quick refresher on popular sorting algorithms and their implementation during their preparation for a technical interview or an examination.
-
From the project's root directory, compile the Utility.java file.
javac helperUtils/Utility.java
-
Then compile the required sort algorithm java code from the root of the project.
For example to compile the bubble sort code:
javac sortAlgorithms/BubbleSort.java
-
Run the compiled code using the
java
command.For example, to run the bubble sort code compiled from the above step:
java sortAlgorithms/BubbleSort
O(n^2)
Stable Sort
O(n^2)
Unstable Sort
O(n^2)
Stable Sort
O(n^2) - Depends on how the Shell interval is selected.
Unstable Sort
O(n logn)
Stable Sort
O(n logn)
Unstable Sort
O(n)
Stable Sort