Question: Task 1 ( 3 0 points ) In this task of the assignment, you are asked to write different sorting algorithms. The goal of the
Task points
In this task of the assignment, you are asked to write different sorting algorithms. The goal of the
homework is to exercise the details of sorting algorithms and have handson experience with
programming with sorting APIs.
For this assignment, you must use your own implementations of the aforementioned sorting
algorithms by taking inspiration from your textbook. You are not allowed to use any external
library or jar file.
The homework consists of steps, and you should follow them sequentially, ie do not go to the
next step before fixing this step. It is recommended that you complete one step per day.
Here are the steps of the homework:
Step In this step, first write a program that i loads integers from a file and ii that creates
a random array. In the text file, the first line in the input file should be the size of the array, and
each following line should consist of a single integer
Step In this second step, modify the insertion sort algorithm on Page of the
textbook such that it sorts the input integer array in descending order, and start sorting the array
FROMRIGHTTOLEFT.Step Use the modified insertion sort algorithm on Page now to sort an array of
float values instead of integers.
Step Modify the topdown Merge Sort algorithm on page to sort the input integer
array in descending order.
Step In this step, create a Car class. Each car should have three fields: a String attribute,
called brand, a second String attribute called modelname, a third attribute of type long,
called modelyear. The Car class should implement the Comparable interface to be able to
compare it with respect to their model years. Check the example on Page of the textbook for
implementing the Comparable interface.
Step Modify the Quick Sort method on Page to sort the given Car objects in
descending order. For this purpose, create different Car objects, each with a different brand,
modelname, modelyear. Then, call this method to sort these objects with respect to their
modelyear's. You also need to modify QuickSort partition method on Page to
reverse its sorting order.
You do not need to prepare a PDF report for this task, just document your code well.ALGORITHM Insertion sort
For each i from to exchange with the entries that are smaller in a through a i As
the index i travels from left to right, the entries to its left are in sorted order in the array, so the array
is fully sorted when i reaches the right end.
Trace of insertion sort array contents just after each insertion
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
