Question: Problem 2 . Write an algorithm called mergesort 3 that sorts an array S of n ints by dividing the array into three subarrays of
Problem Write an algorithm called mergesort that sorts an array of ints by
dividing the array into three subarrays of approximately ints,
sorting each subarray using recursion, and
merging the three sorted subarrays.
A few notes: this algorithm will be very similar to mergesort page except that we are splitting
the array into three subarrays. The algorithm's heading should look like this:
void mergesort int
You may assume that you already have an algorithm
void merge int int int const int const int const int int
that merges an array of size an array of size and an array of size into the sorted array
So you don't have to write merge, you just need to call it within your mergesort algorithm.
Look at picture for better reference.
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
