Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 2 (10 points) Answer the following questions: Rewrite the MERGE(A, p, q, r) module in merge-sort below without using the sentinels (or infinite) in

image text in transcribed

Question 2 (10 points) Answer the following questions: Rewrite the MERGE(A, p, q, r) module in merge-sort below without using the sentinels (or infinite) in line 8 and 9. Make sure you change inside for loop as well. MERGE(A, p, q, r) 1. n1 = 9-p+1 2. n2 =r-9 3. let L[1..ni + 1] and R[1..n2 + 1] be new arrays 4. for i = 1 to ni 5. L[i] = A[p + i - 1] 6. for j = 1 to 12 7. R[j] = A[q + j] 8. L[n1 + 1] = 0 9. R[n2 + 1] = 0 10. i = 1 11. j = 1 12. for k=p to r 13. if L[i] = R[j] 14. A[k] = L[i] 15. i = i +1 16. else A[k] = R[j] 17. j=j +1

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

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

Students also viewed these Databases questions

Question

Write Hund's rule?

Answered: 1 week ago

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago