Given an array and a number k where k is smaller than size of array, we need to find the k’th smallest element in the given array.

# Category - Randomized Algorithms

Given an array and a number k where k is smaller than size of array, we need to find the k’th smallest element in the given array.

Given an array and a number k where k is smaller than size of array, we need to find the k’th smallest element in the given array.

Reservoir sampling is a family of randomized algorithms for randomly choosing k samples from a list of n items, where n is either a very large.

Given an array, write a program to generate a random permutation of array elements. This question is also asked as “shuffle a deck of cards” or “randomize a...

The idea is to use Reservoir Sampling. Following are the steps. This is a simpler version of Reservoir Sampling as we need to select only one key.

The idea is to use Reservoir Sampling. Following are the steps. This is a simpler version of Reservoir Sampling as we need to select only one key.

The idea is to use Reservoir Sampling. Following are the steps. This is a simpler version of Reservoir Sampling as we need to select only one key.

It is quite easy to visualize this statement since the median which we report will be (k/2)th element and if we take k/2 elements from the left quarter.

It is quite easy to visualize this statement since the median which we report will be (k/2)th element and if we take k/2 elements from the left quarter.