Finding K minimum elements from an array in O(n)

0

Quicksort has so many applications.One of them is to find the K minimum elements from a array in O(n) times.

How does quicksort’s O(nlogn) becomes O(n).Well,we need not sort the K minimum elements in order.we just want to find it. So we execute the partition till K becomes pivot position

[gist https://gist.github.com/vishnujayvel/5879546 ]