/COSC_499_DEMO

Just a demo to show I am using GitHub

Primary LanguageJava

COSC_499_DEMO (GITHUB)

Just a demo to show I am using GitHub. Therefore I am building a simple java program that runs two sorting algorithms and compares there run time.

Main Function

The Main function runs the program. It instantiates a sorter from which the two sorting algorithms can be run. It also initializes an array with 15 random numbers to sort. Afterwards the two sorting algorithms are run on the array and the time it takes to sort is taken in nanoseconds and printed out afterwards. (As here only functions get called I have not implemented any test cases)

Bubble Sort

The function takes an integer array and sorts it in to an ascending order using the Bubble Sort algorithm. The function can be called via the Sorting class. The tests check whether the array is sorted correctly.

Insertion Sort

The function takes an integer array and sorts it in to an ascending order. The function can be called via the Sorting class. The Test cases check, that the entered array gets sorted over the whole range (test cases biggest number first, smallest last), as well as that the function does not crash on an empty array.