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]
escription: ollowing is the Merge Sort Algorithm discussed in class: here p and r represent lower and upper bounds of ar
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
escription: ollowing is the Merge Sort Algorithm discussed in class: here p and r represent lower and upper bounds of ar
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!