Question: Problem Statement Given an array of size ' n ' , sort the array in ascending order using Merge Sort algorithm and find out the
Problem Statement
Given an array of size sort the array in ascending order using Merge Sort algorithm and find out the median value. The median is the value that is present in the middle of a sorted array containing odd number of values. If the sorted array contains even number of values, median is the average of middle two values.
Implement the functionalities based on the description given below.
Method Description
mergeSortint elements, int size
Sort the array using the merge sort algorithm
mergeint elements, int left, int right, int leftMerge, int rightMerge
Merge the left array and right array to produce new sorted arrays
findMedianint elements
Find out and return the median value
Test the functionalities using the main method of the Tester class.
Sample Input and Output
tableSample Input,Expected Outputarr art
Download the Java project from here to solve this exereise in Eclipse
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
