In the following recursive function, A is the input array with size n. RANDOM(n) produces a uniformly random number between 1 and n. 1: function RECALG2(A, n) if n


In the following recursive function, A is the input array with size n. RANDOM(n) produces a<br>uniformly random number between 1 and n.<br>1: function RECALG2(A, n)<br>if n < 5 then return A[1]<br>2:<br>for i + 1 to | yn] do<br>A[i] <- A[i] – A[[i * /n]]<br>s– A[1]<br>k + RANDOM(n)<br>if k < 2n/3 then<br>s+ s+RECALG2(A,n)<br>3:<br>4:<br>5:<br>6:<br>7:<br>8:<br>return s<br>(a) Determine its worst case asymptotic time complexity.<br>(b) Using probabilistic analysis, determine its average asymptotic time complexity.<br>

Extracted text: In the following recursive function, A is the input array with size n. RANDOM(n) produces a uniformly random number between 1 and n. 1: function RECALG2(A, n) if n < 5="" then="" return="" a[1]="" 2:="" for="" i="" +="" 1="" to="" |="" yn]="" do="" a[i]=""><- a[i]="" –="" a[[i="" *="" n]]="" s–="" a[1]="" k="" +="" random(n)="" if="" k="">< 2n/3="" then="" s+="" s+recalg2(a,n)="" 3:="" 4:="" 5:="" 6:="" 7:="" 8:="" return="" s="" (a)="" determine="" its="" worst="" case="" asymptotic="" time="" complexity.="" (b)="" using="" probabilistic="" analysis,="" determine="" its="" average="" asymptotic="" time="">

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here