According to Wikipedia, "an algorithm is a self-contained sequence of actions to be performed... algorithms can perform calculation, data processing, and automated reasoning tasks."
Algorithms are awesome. They are a foundation to our lives as a function of modern mathematics, computer science & and statistics.
In this project we cover five popular sorting algorithms and their implementation in Java:
We first create a project directory, then a Java interface, and finally a Java class for each algorithm as well as its respective test.
Create Project Directory Sorting
Create a project called Sorting and include all your code in it.
$ mkdir Sorting
$ cd Sorting
Create Interface Sort.java
First, create an interface called Sort.java.
$ touch Sort.java
Input this code into Sort.java:
Notice that we specified a sort() method, which returns an integer array specified by int, and equally takes an integer array specified by int within the parenthesis.
Now it's time to create classes for each of the sorting algorithms.