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 : Analyzing Code III: Writing Recurrences
Problem 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 Recurrences
: procedure MergeSortList L
: if lenL then return L
: n lenL
: f irst MergeSortL : n
: second MergeSortLn : n
: third MergeSortLn : n
: for i ; i n; i i do
: print Hi This loop doesnt actually do anything! But has the same runtime as a way merge
: return L
Answer Standard : Analyzing Code III: Writing Recurrences
Problem 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 Recurrences
procedure MERGESoRTList
if len then return
nlarrlen
second larrMergeSort:
third larrMergeSort:
for ilarr;;ilarri do
print Hi This loop doesn't actually do anything! But has the same runtime as a way merge
return
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
