Partial Sort solved by 602

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

Topics: Sorting

Problem

Given: A positive integer $n \le 10^5$ and an array $A[1..n]$ of integers from $-10^5$ to $10^5$, a positive integer $k \le 1000$.

Return: The $k$ smallest elements of a sorted array $A$.

Sample Dataset

10
4 -6 7 8 -9 100 12 13 56 17
3

Sample Output

-9 -6 4

Please login to solve this problem.