Processing math: 100%

Median solved by 748

Feb. 21, 2014, 5:36 p.m. by Rosalind Team

Topics: Sorting

Problem

The task is to implement a linear time randomized algorithm for the selection problem.

Given: A positive integer n105 and an array A[1..n] of integers from 105 to 105, a positive number kn.

Return: The k-th smallest element of A.

Source: Algorithms by Dasgupta, Papadimitriou, Vazirani. McGraw-Hill. 2006.

Sample Dataset

11
2 36 5 21 8 13 11 20 5 4 1
8

Sample Output

13

Please login to solve this problem.

Welcome to Rosalind!

Rosalind is a platform for learning bioinformatics through problem solving.
Please login with Google/Twitter/Facebook or register a new account.