# In this problem, we use indicator random variables to analyze the RANDOMIZED SELECT procedure in a manner akin to our

## Question:

As in the quicksort analysis, we assume that all elements are distinct, and we rename the elements of the input array A as z_{1}, z_{2}, . . . ,z_{n}, where z_{i} is the i th smallest element. Thus, the call RANDOMIZED-SELECT ( A, 1, n, k) returns z_{k}. For 1 ‰¤ i < j ‰¤ n, let X_{ijk} = I {z_{i} is compared with z_{j} sometime during the execution of the algorithm to find z_{k}}.

a. Give an exact expression for E [X_{ijk}]. Your expression may have different values, depending on the values of i, j, and k.

b. Let X_{k} denote the total number of comparisons between elements of array A when finding z_{k}. Show that

c. Show that E [X_{k}] ‰¤ 4n.

d. Conclude that, assuming all elements of array A are distinct, RANDOMIZED SELECT runs in expected time O(n).

## This problem has been solved!

## Step by Step Answer:

**Related Book For**

## Introduction to Algorithms

**ISBN:** 978-0262033848

3rd edition

**Authors:** Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest

**Question Details**

**9**

**View Solution**

**Cannot find your solution?**