Array Partition
Array Partition
import java.util.*;
do{
run();
System.out.print("\nTo continue press 0: ");
} while(s.nextLine().charAt(0) == '0');
if(arr.length%2!=0){
System.out.println("Invalid Input!");
return;
}
selectionSort(arr);
}
public static void selectionSort(int[] arr){
int minIndex = i;
int ans = 0;
return ans;
OUTPUT
Array size = 8
Enter elements:
3 8 1 5 0 2 7 3
Sorted Array: [0, 1, 2, 3, 3, 5, 7, 8]
Max sum of pairs = 17
To continue press 0: 1