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 eg float and to sort the array in descending order. That is convert the algorithm to use generic data types. Specifically,
Create a class called SortingAlgorithm
Implement a generic method bubbleSort that sorts a generic data type array.
Create an array of floats, eg
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
