How many times does randommin execute line


Consider the following algorithm for finding the smallest element in an unsorted array:
RANDOMMIN(A[1 .. n]):
min ← ∞
for i ← 1 to n in random order
if A[i] < min
min ← A[i] ( )
return min
(a) In the worst case, how many times does RANDOMMIN execute line ?
(b) What is the probability that line is executed during the nth iteration of the for loop?
(c) What is the exact expected number of executions of line ? 

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: How many times does randommin execute line
Reference No:- TGS0117741

Expected delivery within 24 Hours