Question: learn the implementation of insertion sort. In the lecture, we saw the implementation of insertion sort for sorting integers in ascending order. Your task is

learn the implementation of insertion sort.
In the lecture, we saw the implementation of insertion sort for sorting integers in ascending order. Your task is to modify the implementation of insertion sort algorithm to accept generic data types (e.g., float) and to sort the array in descending order. That is, convert the algorithm to use generic data types. Specifically,
1. Create a class called SortingAlgorithm
2. Implement a generic method bubbleSort that sorts a generic data type array.
3. Create an array of 10 floats, e.g.[10.0,3.5,3.1,5.5,10.2,30.3,50.1,78,90.4,12.4]
4. Sort the array using insertion sort to sort the array in descending order.
use Comparator class to implement comparing generic data types.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!