Menu

In The Lecture, We Saw The Implementation Of Insertion Sort And Bubble Sort For Sorting Integers In Ascending Order. Your Task Is To Modify The Implementation Of The Two Sorting Algorithms To Accept Generic Data Types (E.G., Float) And To Sort The Array In Descending Order. That Is, Convert Those Algorithms To Use Generic Data Types. Specifically,Create A

In The Lecture, We Saw The Implementation Of Insertion Sort And Bubble Sort For Sorting Integers In Ascending Order. Your Task Is To Modify The Implementation Of The Two Sorting Algorithms To Accept Generic Data Types (E.G., Float) And To Sort The Array In Descending Order. That Is, Convert Those Algorithms To Use Generic Data Types. Specifically,Create A

In the lecture, we saw the implementation of insertion sort and bubble sort for sorting integers in ascending order. Your task is to modify the implementation of the two sorting algorithms to accept generic data types (e.g., float) and to sort the array in descending order. That is, convert those algorithms to use generic data types. Specifically,

  1. Create a class called SortingAlgorithms
  2. Implement a generic method insertionSort that sorts a generic data type array.
  3. Implement a generic method bubbleSort that sorts a generic data type array.
  4. 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]
  5. Sort the array using both insertion sort and bubble sort to sort the array in descending order.

Expert Answer

Step 1

First, we define the SortingAlgorithms class template and implement a generic method insertionSort t

OR