Question: In Python Implement a merge sort algorithm in your favorite programming language ( e . g . C , Java, Python, etc. ) . Modify
In Python
Implement a merge sort algorithm in your favorite programming language eg
C Java, Python, etc. Modify the code, so that it prints the following:
The initial input sequence to be sorted, and its length.
The order of the elements in the sequence, after the "merge step" has been
performed on all the elements. Print this for every recursion depth, in the
order the merges are performed.
The total number of comparison operations performed during the run of the
algorithm a comparison operation is when array elements are compared
For instance, if the input array is you should print:
INPUT: length
MERGE STEP :
MERGE STEP :
MERGE STEP :
COMPARISONS :
Note that the number of comparisons will depend not only on the input given, but
the specific way you implement merge sort, so you may get a slightly different
number than above.
Submit a print out of your code, and its output on the following input test cases:
Array of numbers dots,already in correct sorted order
Array of numbers dots,reverse of correct sorted order
Array of different random numbers
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
