Write an iterative version of RANDOMIZED_SELECT. This question(Q 9.2-3) is from Introduction to Algorithms, second edition,Thomas H. Cormen and others. Please do not copy the answer alreadyavailable in cramster solutions. Please provide detail steps. Thanks a ton. Write an iterative version of RANDOMIZED_SELECT. This question(Q 9.2-3) is from Introduction to Algorithms, second edition,Thomas H. Cormen and others. Please do not copy the answer alreadyavailable in cramster solutions. Please provide detail steps. Thanks a ton.
Explanation / Answer
Dear User, An iterative version of RANDOMIZED_SELECTalgorithm RANDOMIZED_SELECT(A,p,r,i) whilep< r q= RANDOMIZED-PARTITION(A,p,r) k= q - p + 1 if i<= k then r=q else p= q + 1 i = i - k returnp I hope this will helps toyou