Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This question is related to merge sort, and what I mean by trace I would like it to be in a table like this where
This question is related to merge sort, and what I mean by trace I would like it to be in a table like this
where p= first index, q=midlle index and r = last index. and the pseudocode is like this..
Pseudo-code Trace the pseudo-code using: a. [12,17, 6,7] p q r k nl n2 i 1 j MERGE(A, p.0,r) 1 n = 9-p + 1 2 n2 = r-9 3 let L[1..n, + 1) and R[1 .. 12 + 1] be new arrays 4 for i = 1 to ni 5 L[i] = Ap + i - 1] 6 for j = 1 to 12 7 R[j] = A[g + i] 8 L[n + 1] = = 0 9 Rin2 + 1] - = 0 = 10 i = 1 11 j = 1 12 for k = p to r 13 if L[i] = R[;) 14 A[k] = L[i] 15 i = i +1 16 else A[k] = R[] 17 j = j +1Step 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