Question: Standard 1 6 : Analyzing Code III: Writing Recurrences Problem 1 6 . Write down a recurrence for the number of times this algorithm prints

Standard 16: Analyzing Code III: Writing Recurrences
Problem 16. Write down a recurrence for the number of times this algorithm prints Hi. Clearly justify
your answer. You are not being asked to solve the recurrence.
Algorithm 1 Recurrences
1: procedure Merge3Sort(List L)
2: if len(L)=1 then return L
3: n len(L)
4: f irst Merge3Sort(L[0 : n/3])
5: second Merge3Sort(L[n/3 : 2n/3])
6: third Merge3Sort(L[2n/3 : n])
7: for i 1; i = n; i i +1 do
8: print Hi// This loop doesnt actually do anything! But has the same runtime as a 3-way merge
9: return L
Answer16 Standard 16: Analyzing Code III: Writing Recurrences
Problem 16. Write down a recurrence for the number of times this algorithm prints "Hi". Clearly justify
your answer. You are not being asked to solve the recurrence.
Algorithm 1 Recurrences
procedure MERGE3SoRT(List L)
if len(L)1 then return L
nlarrlen(L)
second larrMerge3Sort(L[n3:2n3])
third larrMerge3Sort(L[2n3:n])
for ilarr1;in;ilarri+1 do
print "Hi"// This loop doesn't actually do anything! But has the same runtime as a 3-way merge
return L
 Standard 16: Analyzing Code III: Writing Recurrences Problem 16. Write down

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!