Merge Sort Program in Java
The Merge Sort is a sorting algorithm which is based on the divide-and conquer approach. It works as follows: It divides a list into two halves. Sort the two halves recursively using merge sort. Merge the two sorted halves to form the final sorted list. Below is the Java program that implements merge sort on a list of integers stored in an array: import java.util.Scanner; class MergeSort{ int arr[]; int capacity; public MergeSort(int size){ capacity = size; arr = new int[capacity]; } public void input(){ Scanner in = new Scanner(System.in); System.out.println("Enter " + capacity + " elements:"); for(int i = 0; i < arr.length; i++) arr[i] = Integer.parseInt(in.nextLine()); } public void recur(int a[], int lo...