Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider mergesort as discussed in class. Instead of dividing the set of numbers into two nearly equal parts, we can partition the set of
Consider mergesort as discussed in class. Instead of dividing the set of numbers into two nearly equal parts, we can partition the set of n numbers into three nearly equal n+1 n+2 parts containing [], [], and [2] numbers, sort each part separately, and then combine them 3 together into one sorted list. (a) [10 points] Write the pseudocode of the combining algorithm. (b) [20 points] Analyze the running time (or, equivalently, the number of comparisons, where a comparison is the act of comparing two numbers) made by this new version of mergesort in the worst case. A correct answer should give the recurrence, explain why it is correct and then present its solution. Try to get as tight a bound as you can. Excessively loose bounds on the number of comparisons will incur a loss of most points for this problem. For simplicity, you may assume that n is a multiple of 3 (hence, you could just write 1/3 instead of [1/3] or [n/3]).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started