Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(a) (10 points) Suppose you implement a variant of MergeSort. Instead of breaking the given list into 2 sublists, you break the given list into

image text in transcribed

(a) (10 points) Suppose you implement a variant of MergeSort. Instead of breaking the given list into 2 sublists, you break the given list into 3 sublists. Write the complete resulting algorithm here in pseudocode. Included below is pseudocode for MergeSort as discussed in class. Solution: Algorithm 1: MergeSort with a 2 piece recursion (replace this pseudocode with your own; model your answer on this) Function MERGESORT(A) : If LEN(A)=1 : L Return A Let m2LEN(A) Let LA[1:m],RA[m+1:n] Let LMERGESORT(L) Let RMERGESORT(R) Let AMergE(L,R) - Return A Function MERGE(L,R) : Let nLEN(L)+LEN(R) Let A [] Let j1,k1 For i=1n If j>LEN(L) : [A[i]R[k]kk+1 ElseIf k>LEN(R) : [A[i]L[j]jj+1 ElseIf L[j]R[k] : [A[i]L[j]jj+1 Else A[i]R[k] kk+1 (b) (5 points) Is this algorithm more efficient, less efficient, or equally efficient as the standard MergeSort algorithm in terms of asymptotic time complexity? Justify your answer. This question will involve material covered on January 23, 2023 in class. Solution

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

More Books

Students also viewed these Databases questions