IN JAVA ECLIPSE PLEASE CAN THEY PLEASE ALSO BE TWO SEPERATE
IN JAVA ECLIPSE PLEASE. CAN THEY PLEASE ALSO BE TWO SEPERATE FILES
1. Write a modified version of selection sort algorithm that selects the largest element each time and movies it to the end of the array, rather than selecting the smallest element and moving it to the beginning.
2. Write a modified “dual” version of the selection sort algorithm that selects both the largest and smallest elements on each pass and moves each of them to the appropriate end of the array.
Solution
1) public void selectionSort(int[] arr) {
int i, j, minIndex, tmp;
int n = arr.length;
for (i = 0; i < n - 1; i++) {
minIndex = i;
for (j = i + 1; j < n; j++)
if (arr[j] < arr[minIndex])
minIndex = j;
if (minIndex != i) {
tmp = arr[i];
arr[i] = arr[minIndex];
arr[minIndex] = tmp;
}
}
}

