escription: ollowing is the Merge Sort Algorithm discussed in class: here p and r represent lower and upper bounds of ar
Posted: Thu Jul 14, 2022 2:11 pm
escription: ollowing is the Merge Sort Algorithm discussed in class: here p and r represent lower and upper bounds of array A respectively. The Merge Sort calls the llowing Merge Algorithm that accepts q as the mid of the array along with p and r :
Task - 1: Write a java program (IntegerMergeSort. java) to implement the Merge Sort algorithm to sort the integer array. Your program will have the following method signature: - public void mergeSort(int[] A, int lowerBound, int upperBound) - public void merge(int[] A, int lowerBound, int midPoint, int upperBound) Task-2: Write a java program (AnyTypeMergeSort. Java) to implement the Merge Sort algorithm to sort the array containing any type of elements (suppose strings). Your program will have the following method signature: - public void mergeSort(T[] A, int lowerBound, int upperBound) - public void merge(T[] A, int lowerBound, int midPoint, int upperBound) [Hint: use Comparable interface from java library and override the Compare'To method to compare two objects. Read some stuff about Comparable interface here. https://docs.oracle.com/javase/8/docs/a ... rable.html]
Task - 1: Write a java program (IntegerMergeSort. java) to implement the Merge Sort algorithm to sort the integer array. Your program will have the following method signature: - public void mergeSort(int[] A, int lowerBound, int upperBound) - public void merge(int[] A, int lowerBound, int midPoint, int upperBound) Task-2: Write a java program (AnyTypeMergeSort. Java) to implement the Merge Sort algorithm to sort the array containing any type of elements (suppose strings). Your program will have the following method signature: - public void mergeSort(T[] A, int lowerBound, int upperBound) - public void merge(T[] A, int lowerBound, int midPoint, int upperBound) [Hint: use Comparable interface from java library and override the Compare'To method to compare two objects. Read some stuff about Comparable interface here. https://docs.oracle.com/javase/8/docs/a ... rable.html]