Given the code for selection sort and the class definition DClass below, modify the sort algorithm to take an array of t
Posted: Fri May 20, 2022 2:56 pm
Given the code for selection sort and the class definition DClass below, modify the sort algorithm to take an array of type DClass and sort it numerically. That is, rewrite the selection sort algorithm given below so that it is able to sort an array of objects of DClass based on the private int member value. class Class { private: int value; public: void setValue(int m) { value m; } int getValue const { return value; } }; void selectionSort(int num, int sizeofArr) { int minimum, minIndex, index, temp: for(int start- ; start < sizeofArr 1; start++) { minimum num[start]: minIndex start: for(index - start + 1; index < sizeofArr; index++) { if(num[index] < minimum) minimum - num[index]: minIndex - index; 3 temp = num[start]: num[start] - num[minIndex); num[minIndex) - temps