Assignment 2
Assignment 2
Assignment-2
Due-date: Friday, February 2, 2024 @11:59pm
Cut-off date: Sunday, February 4, 2024 @11:59pm
Objective:
The objective of this assignment is to practice and implement recursive versions of different sorting
algorithms.
Problem Specification:
Please download the SortingGenericSample before start. Write generic recursive Java pro-
grams which reads the elements from the following array and then sorts them using a selectionSort,
bubbleSort, and insertionSort algorithms.
Sample Output (Using selection sort algorithm): Alan, Bob, Ellen, Janet, Karen, Tom,
Wendy
Sample Output (Using bubble sort algorithm): Alan, Bob, Ellen, Janet, Karen, Tom,
Wendy
Sample Output (Using insertion sort algorithm): Alan, Bob, Ellen, Janet, Karen, Tom,
Wendy
After you have coded your generic recursive sorting algorithms, you need to test and see how
long your sorting algorithms takes to run for input size 10, 100, 1,000, and 10,000. Your program
should create integers and print a table like this: You can get a random list using the java class
Random, located in java.util.Random. To test the speed of your sorting algorithms, you should use
the System.currentTimeMillis() method, which returns a long that contains the current time (in
milliseconds). Call System.currentTimeMillis() before and after the algorithm runs, and subtract
COSC2007: Assignment-2
the two times. Please note that you will not get any credit if you do not implement
generic recursive versions of sorting algorithms with the above-mentioned criteria.
Submission Instructions:
Please note that the submitted work will be considered as your own work and you
confirm that you have not received any unauthorized assistance in preparing for or
doing this lab/assignment/examination. You confirm knowing that a mark of 0 may
be assigned for entire work.
Submit your complete Java source files (.java). Comment your program carefully so that it can
be read and understood. If your program is not properly commented you may lose marks. See
marking scheme for details.
Marking Scheme:
You will receive full credits for the working code, otherwise zero. No partial credits!