Question: A programmer has written the following function for implementing the merge sort algorithm, but is not sure if the function is correct. void merge _
A programmer has written the following function for implementing the merge sort algorithm, but is not sure if the function is correct.
void mergesortvector& a int from, int to
if from to return;
int mid from to;
Sort the first and the second half
mergesorta from mid;
mergesorta mid to;
mergea from, mid, to;
What is true about this mergesort function?
Question options:
It is a recursive function that will never terminate.
The call to merge is not necessary.
There is a mistake in the parameters passed to the recursive calls to mergesort.
The mergesort function works perfectly as written.
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
